From 51d19ac1f590e4788de957dc0bc76fa4734a071c Mon Sep 17 00:00:00 2001 From: Angoosh Date: Tue, 3 Oct 2023 01:10:10 +0200 Subject: [PATCH] added shabang to pc main.py so it can be escecuted with minimal fuzz --- SW/PC/main.py | 8 +++++--- SW/RPi_Pico/main.py | 28 ++++++++++++++++++++++++++-- 2 files changed, 31 insertions(+), 5 deletions(-) mode change 100644 => 100755 SW/PC/main.py diff --git a/SW/PC/main.py b/SW/PC/main.py old mode 100644 new mode 100755 index f0c71d1..c451672 --- a/SW/PC/main.py +++ b/SW/PC/main.py @@ -1,3 +1,5 @@ +#!/usr/bin/python + import serial import json from datetime import datetime @@ -73,7 +75,7 @@ def write(ser): break def main(): - s = serial.Serial(port="/dev/ttyACM1", parity=serial.PARITY_EVEN, stopbits=serial.STOPBITS_ONE, timeout=1) + s = serial.Serial(port="/dev/ttyACM0", parity=serial.PARITY_EVEN, stopbits=serial.STOPBITS_ONE, timeout=1) s.flush() rw = input('Read or Write tags? [R/w]') @@ -95,5 +97,5 @@ def main(): -if __name__ == "__main__": - main() \ No newline at end of file +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/SW/RPi_Pico/main.py b/SW/RPi_Pico/main.py index f2415e3..889ddcb 100644 --- a/SW/RPi_Pico/main.py +++ b/SW/RPi_Pico/main.py @@ -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