Open huise0ng opened 7 months ago
ubuntu@ubuntu:~/home/pi/mywebapp$ python3 hardware.py
Traceback (most recent call last):
File "/home/ubuntu/home/pi/mywebapp/hardware.py", line 13, in
ubuntu@ubuntu:~/home/pi/mywebapp$ sudo python3 hardware.py
Traceback (most recent call last):
File "/home/ubuntu/home/pi/mywebapp/hardware.py", line 2, in
import RPi.GPIO as GPIO
import busio
from digitalio import DigitalInOut
from adafruit_pn532.spi import PN532_SPI
SCK = GPIO.SCLK
MISO = GPIO.MISO
MOSI = GPIO.MOSI
CS = DigitalInOut(GPIO.D5)
spi = busio.SPI(SCK, MOSI, MISO)
pn532 = PN532_SPI(spi, CS, debug=False)
print("Waiting for an NFC card...")
while True:
try:
uid = pn532.read_passive_target(timeout=0.5)
if uid is not None:
print("Found NFC card with UID:", [hex(i) for i in uid])
time.sleep(1)
except KeyboardInterrupt:
break
ubuntu@ubuntu:~/home/pi/mywebapp$ sudo python3 hardware.py
Traceback (most recent call last):
File "/home/ubuntu/home/pi/mywebapp/hardware.py", line 2, in
import RPi.GPIO as GPIO
import busio
from digitalio import DigitalInOut
from adafruit_pn532.spi import PN532_SPI
GPIO.setmode(GPIO.BCM) # BCM 핀 번호 사용
SCK = GPIO.SCLK
MISO = GPIO.MISO
MOSI = GPIO.MOSI
CS = DigitalInOut(GPIO.D5)
spi = busio.SPI(SCK, MOSI, MISO)
pn532 = PN532_SPI(spi, CS, debug=False)
print("Waiting for an NFC card...")
while True:
try:
uid = pn532.read_passive_target(timeout=0.5)
if uid is not None:
print("Found NFC card with UID:", [hex(i) for i in uid])
time.sleep(1)
except KeyboardInterrupt:
break
ubuntu@ubuntu:~/home/pi/mywebapp$ sudo python3 hardware.py
Traceback (most recent call last):
File "/home/ubuntu/home/pi/mywebapp/hardware.py", line 2, in
import RPi.GPIO as GPIO
from digitalio import DigitalInOut
from adafruit_pn532.spi import PN532_SPI
GPIO.setmode(GPIO.BCM) # BCM 핀 번호 사용
SCK = GPIO.SCLK
MISO = GPIO.MISO
MOSI = GPIO.MOSI
CS = DigitalInOut(GPIO.D5)
pn532 = PN532_SPI(SCK, MOSI, MISO, CS, debug=False)
print("Waiting for an NFC card...")
while True:
try:
uid = pn532.read_passive_target(timeout=0.5)
if uid is not None:
print("Found NFC card with UID:", [hex(i) for i in uid])
time.sleep(1)
except KeyboardInterrupt:
break
ubuntu@ubuntu:~/home/pi/mywebapp$ sudo python3 hardware.py
Traceback (most recent call last):
File "/home/ubuntu/home/pi/mywebapp/hardware.py", line 2, in
import RPi.GPIO as GPIO
from adafruit_pn532 import PN532_SPI
GPIO.setmode(GPIO.BCM)
# 원하는 핀 번호로 변경하세요
SCK = 11
MISO = 9
MOSI = 10
CS = 8
pn532 = PN532_SPI(spi_bus=0, spi_device=0, cs=CS, sclk=SCK, miso=MISO, mosi=MOSI, debug=False)
print("Waiting for an NFC card...")
while True:
try:
uid = pn532.read_passive_target(timeout=0.5)
if uid is not None:
print("Found NFC card with UID:", [hex(i) for i in uid])
time.sleep(1)
except KeyboardInterrupt:
GPIO.cleanup()
break
ubuntu@ubuntu:~/home/pi/mywebapp$ sudo python3 hardware.py
Traceback (most recent call last):
File "/home/ubuntu/home/pi/mywebapp/hardware.py", line 2, in
ubuntu@ubuntu:~/home/pi/mywebapp$ sudo python3 hardware.py
Traceback (most recent call last):
File "/home/ubuntu/home/pi/mywebapp/hardware.py", line 2, in
import time import RPi.GPIO as GPIO from adafruit_pn532 import PN532
GPIO.setmode(GPIO.BCM)
SCK = 11 # BCM 핀 번호 사용 MISO = 9 MOSI = 10 CS = 8
pn532 = PN532(sclk=SCK, mosi=MOSI, miso=MISO, cs=CS, debug=False)
print("Waiting for an NFC card...")
while True: try: uid = pn532.read_passive_target(timeout=0.5) if uid is not None: print("Found NFC card with UID:", [hex(i) for i in uid]) time.sleep(1) except KeyboardInterrupt: GPIO.cleanup() break
File "/home/ubuntu/home/pi/mywebapp/hardware.py", line 17 try: ^ IndentationError: expected an indented block after 'while' statement on line 16
import RPi.GPIO as GPIO
from adafruit_pn532 import PN532
GPIO.setmode(GPIO.BCM)
SCK = 11 # BCM 핀 번호 사용
MISO = 9
MOSI = 10
CS = 8
pn532 = PN532(sclk=SCK, mosi=MOSI, miso=MISO, cs=CS, debug=False)
print("Waiting for an NFC card...")
try:
while True:
uid = pn532.read_passive_target(timeout=0.5)
if uid is not None:
print("Found NFC card with UID:", [hex(i) for i in uid])
time.sleep(1)
except KeyboardInterrupt:
GPIO.cleanup()
ubuntu@ubuntu:~/home/pi/mywebapp$ sudo python3 hardware.py
Traceback (most recent call last):
File "/home/ubuntu/home/pi/mywebapp/hardware.py", line 2, in
import RPi.GPIO as GPIO
from adafruit_pn532 import PN532_SPI
GPIO.setmode(GPIO.BCM)
SCK = 11 # BCM 핀 번호 사용
MISO = 9
MOSI = 10
CS = 8
pn532 = PN532_SPI(sclk=SCK, mosi=MOSI, miso=MISO, cs=CS, debug=False)
print("Waiting for an NFC card...")
try:
while True:
uid = pn532.read_passive_target(timeout=0.5)
if uid is not None:
print("Found NFC card with UID:", [hex(i) for i in uid])
time.sleep(1)
except KeyboardInterrupt:
GPIO.cleanup()
import time import RPi.GPIO as GPIO from adafruit_pn532.spi import PN532_SPI
GPIO.setmode(GPIO.BCM)
SCK = 11 # 변경하려는 SCK 핀 번호 MISO = 9 # 변경하려는 MISO 핀 번호 MOSI = 10 # 변경하려는 MOSI 핀 번호 CS = 8 # 변경하려는 CS 핀 번호
pn532 = PN532_SPI(spi_bus=0, spi_device=0, cs=CS, sclk=SCK, miso=MISO, mosi=MOSI, debug=False)
print("Waiting for an NFC card...")
try: while True: uid = pn532.read_passive_target(timeout=0.5) if uid is not None: print("Found NFC card with UID:", [hex(i) for i in uid]) time.sleep(1) except KeyboardInterrupt: GPIO.cleanup()
ubuntu@ubuntu:~/home/pi/mywebapp$ sudo python3 hardware.py File "/home/ubuntu/home/pi/mywebapp/hardware.py", line 17 while True: ^ IndentationError: expected an indented block after 'try' statement on line 16
import time import RPi.GPIO as GPIO from adafruit_pn532.spi import PN532_SPI
GPIO.setmode(GPIO.BCM)
SCK = 11 # 변경하려는 SCK 핀 번호 MISO = 9 # 변경하려는 MISO 핀 번호 MOSI = 10 # 변경하려는 MOSI 핀 번호 CS = 8 # 변경하려는 CS 핀 번호
pn532 = PN532_SPI(spi_bus=0, spi_device=0, cs=CS, sclk=SCK, miso=MISO, mosi=MOSI, debug=False)
print("Waiting for an NFC card...")
try: while True: uid = pn532.read_passive_target(timeout=0.5) if uid is not None: print("Found NFC card with UID:", [hex(i) for i in uid]) time.sleep(1) except KeyboardInterrupt: GPIO.cleanup()
ubuntu@ubuntu:~/home/pi/mywebapp$ sudo python3 hardware.py File "/home/ubuntu/home/pi/mywebapp/hardware.py", line 17 while True: ^ IndentationError: expected an indented block after 'try' statement on line 16
import time import RPi.GPIO as GPIO from adafruit_pn532.spi import PN532_SPI
GPIO.setmode(GPIO.BCM)
SCK = 11 # 변경하려는 SCK 핀 번호 MISO = 9 # 변경하려는 MISO 핀 번호 MOSI = 10 # 변경하려는 MOSI 핀 번호 CS = 8 # 변경하려는 CS 핀 번호
pn532 = PN532_SPI(spi_bus=0, spi_device=0, cs=CS, sclk=SCK, miso=MISO, mosi=MOSI, debug=False)
print("Waiting for an NFC card...")
try: while True: uid = pn532.read_passive_target(timeout=0.5) if uid is not None: print("Found NFC card with UID:", [hex(i) for i in uid]) time.sleep(1) except KeyboardInterrupt: GPIO.cleanup()
ubuntu@ubuntu:~/home/pi/mywebapp$ sudo python3 hardware.py File "/home/ubuntu/home/pi/mywebapp/hardware.py", line 17 while True: ^ IndentationError: expected an indented block after 'try' statement on line 16
import time import RPi.GPIO as GPIO from adafruit_pn532.spi import PN532_SPI
GPIO.setmode(GPIO.BCM)
SCK = 11 # 변경하려는 SCK 핀 번호 MISO = 9 # 변경하려는 MISO 핀 번호 MOSI = 10 # 변경하려는 MOSI 핀 번호 CS = 8 # 변경하려는 CS 핀 번호
pn532 = PN532_SPI(spi_bus=0, spi_device=0, cs=CS, sclk=SCK, miso=MISO, mosi=MOSI, debug=False)
print("Waiting for an NFC card...")
try: while True: uid = pn532.read_passive_target(timeout=0.5) if uid is not None: print("Found NFC card with UID:", [hex(i) for i in uid]) time.sleep(1) except KeyboardInterrupt: GPIO.cleanup()
ubuntu@ubuntu:~/home/pi/mywebapp$ sudo python3 hardware.py File "/home/ubuntu/home/pi/mywebapp/hardware.py", line 23 GPIO.cleanup()) ^ SyntaxError: unmatched ')'
import time import RPi.GPIO as GPIO from adafruit_pn532.spi import PN532_SPI
GPIO.setmode(GPIO.BCM)
SCK = 11 # 변경하려는 SCK 핀 번호 MISO = 9 # 변경하려는 MISO 핀 번호 MOSI = 10 # 변경하려는 MOSI 핀 번호 CS = 8 # 변경하려는 CS 핀 번호
pn532 = PN532_SPI(spi_bus=0, spi_device=0, cs=CS, sclk=SCK, miso=MISO, mosi=MOSI, debug=False)
print("Waiting for an NFC card...")
try: while True: uid = pn532.read_passive_target(timeout=0.5) if uid is not None: print("Found NFC card with UID:", [hex(i) for i in uid]) time.sleep(1) except KeyboardInterrupt: GPIO.cleanup()
import time import RPi.GPIO as GPIO from adafruit_pn532.spi import PN532_SPI
GPIO.setmode(GPIO.BCM)
SCK = 11 # 변경하려는 SCK 핀 번호 MISO = 9 # 변경하려는 MISO 핀 번호 MOSI = 10 # 변경하려는 MOSI 핀 번호 CS = 8 # 변경하려는 CS 핀 번호
pn532 = PN532_SPI(spi_bus=0, spi_device=0, cs=CS, sclk=SCK, miso=MISO, mosi=MOSI, debug=False)
print("Waiting for an NFC card...")
try: while True: uid = pn532.read_passive_target(timeout=0.5) if uid is not None: print("Found NFC card with UID:", [hex(i) for i in uid]) time.sleep(1) except KeyboardInterrupt: GPIO.cleanup()