added rpi pico code and base pc code
This commit is contained in:
33
SW/PC/main.py
Normal file
33
SW/PC/main.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import serial
|
||||
|
||||
def main():
|
||||
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]')
|
||||
rw = rw.lower()
|
||||
|
||||
if rw == 'w':
|
||||
s.write('w'.encode())
|
||||
while True:
|
||||
data = input('ID:')
|
||||
s.write(data.encode())
|
||||
elif rw == 'r':
|
||||
s.write('r\r'.encode())
|
||||
while True:
|
||||
mes = s.read_until(b'\r')
|
||||
print(mes.decode())
|
||||
elif rw == '':
|
||||
s.write('r\r'.encode())
|
||||
while True:
|
||||
mes = s.read_until(b'\r')
|
||||
if mes != '':
|
||||
print(mes.decode())
|
||||
else:
|
||||
print('Invalid option')
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user