-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcode.py
More file actions
30 lines (29 loc) · 743 Bytes
/
Copy pathcode.py
File metadata and controls
30 lines (29 loc) · 743 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import board
import busio
import digitalio
import time
import supervisor
#Set UART Pin
uart = busio.UART(board.D0, board.D1, baudrate=9600)
get_input = True
message_started = False
message_print = []
allstring = ""
printshow = False
while True:
if supervisor.runtime.serial_bytes_available:
allstring=""
userinput = input().strip() #input command
b = bytes(userinput, 'utf-8')
uart.write(b)
continue
byte_read = uart.readline()# read one line
if byte_read != None:
allstring += byte_read.decode()
printshow = True
else:
if printshow == True:
if allstring != "":
print(allstring)
allstring=""
printshow ==False