Attendance-check / JJick-check-Hardware

Network Project JJick-Check (찍책) Hardware
0 stars 0 forks source link

C -> python #3

Open huise0ng opened 7 months ago

huise0ng commented 7 months ago
import board
import busio
from digitalio import DigitalInOut
from adafruit_pn532.spi import PN532_SPI

SCK = board.SCLK
MISO = board.MISO
MOSI = board.MOSI
CS = DigitalInOut(board.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
huise0ng commented 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 pn532 = PN532_SPI(spi, CS, debug=False) File "/home/ubuntu/.local/lib/python3.10/site-packages/adafruit_pn532/spi.py", line 103, in init super().init(debug=debug, irq=irq, reset=reset) File "/home/ubuntu/.local/lib/python3.10/site-packages/adafruit_pn532/adafruitpn532.py", line 175, in init = self.firmware_version File "/home/ubuntu/.local/lib/python3.10/site-packages/adafruit_pn532/adafruit_pn532.py", line 362, in firmware_version raise RuntimeError("Failed to detect the PN532") RuntimeError: Failed to detect the PN532

huise0ng commented 7 months ago

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 board ModuleNotFoundError: No module named 'board'

huise0ng commented 7 months ago
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
huise0ng commented 7 months ago

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 busio ModuleNotFoundError: No module named 'busio'

huise0ng commented 7 months ago
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
huise0ng commented 7 months ago

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 busio ModuleNotFoundError: No module named 'busio'

huise0ng commented 7 months ago
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
huise0ng commented 7 months ago

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 from digitalio import DigitalInOut ModuleNotFoundError: No module named 'digitalio'

huise0ng commented 7 months ago
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
huise0ng commented 7 months ago

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 from adafruit_pn532 import PN532_SPI ModuleNotFoundError: No module named 'adafruit_pn532'

huise0ng commented 7 months ago

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 from adafruit_pn532 import PN532_SPI ImportError: cannot import name 'PN532_SPI' from 'adafruit_pn532' (/usr/local/lib/python3.10/dist-packages/adafruit_pn532/init.py)

huise0ng commented 7 months ago

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

huise0ng commented 7 months ago

File "/home/ubuntu/home/pi/mywebapp/hardware.py", line 17 try: ^ IndentationError: expected an indented block after 'while' statement on line 16

huise0ng commented 7 months ago
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()
huise0ng commented 7 months ago

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 from adafruit_pn532 import PN532 ImportError: cannot import name 'PN532' from 'adafruit_pn532' (/usr/local/lib/python3.10/dist-packages/adafruit_pn532/init.py)

huise0ng commented 7 months ago
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()
huise0ng commented 7 months ago

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()

huise0ng commented 7 months ago

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

huise0ng commented 7 months ago

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()

huise0ng commented 7 months ago

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

huise0ng commented 7 months ago

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()

huise0ng commented 7 months ago

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

huise0ng commented 7 months ago

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()

huise0ng commented 7 months ago

ubuntu@ubuntu:~/home/pi/mywebapp$ sudo python3 hardware.py File "/home/ubuntu/home/pi/mywebapp/hardware.py", line 23 GPIO.cleanup()) ^ SyntaxError: unmatched ')'

huise0ng commented 7 months ago

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()

huise0ng commented 7 months ago

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()