added shabang to pc main.py so it can be escecuted with minimal fuzz

This commit is contained in:
2023-10-03 01:10:10 +02:00
parent 364d019b3d
commit 51d19ac1f5
2 changed files with 31 additions and 5 deletions

View File

@@ -89,9 +89,22 @@ def read_nfc_loop():
ntag_string = 'Data: '
sys.stdout.write('Reading ntag \r')
leds_on = 0
for page in range(20,40):
try:
ntag2xx_page = pn532.ntag2xx_read_block(page)
if (page % 2) == 0:
if page == 0:
pass
elif page == 2:
pass
else:
led_strip[leds_on] = (0,0,255)
leds_on += 1
if leds_on > 7:
leds_on = 7
led_strip.write()
if ntag2xx_page is not None:
for char in ntag2xx_page:
@@ -162,10 +175,18 @@ def loop():
write_nfc_loop(data)
elif rw == 'r':
while True:
read_nfc_loop()
ret = read_nfc_loop()
if ret == 255:
set_neopixel_color(0,0,255)
rw = None
return 1
elif rw == '':
while True:
read_nfc_loop()
ret = read_nfc_loop()
if ret == 255:
set_neopixel_color(0,0,255)
rw = None
return 1
else:
sys.stdout.write('Invalid option\r')
@@ -181,6 +202,9 @@ while True:
while True:
try:
ret = loop()
if ret == 1:
poll_results = None
break
except:
set_neopixel_color(0,0,255)
break