Skip to content

Commit

Permalink
bit more error checking on the microbit
Browse files Browse the repository at this point in the history
  • Loading branch information
cpmpercussion committed Aug 22, 2024
1 parent 58521d0 commit 302b107
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/microbit_serial_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ def receive_and_display():
data = uart.readline()
if data is None:
return
data = data.decode('utf-8').strip().split(',')
try:
data = data.decode('utf-8').strip().split(',')
except Exception as e:
data = ""
pass
if len(data) == 3:
try:
x, y, z = map(float, data)
Expand Down

0 comments on commit 302b107

Please sign in to comment.