Skip to content

Commit cceaf0d

Browse files
committed
Check if UARTService is in waiting before reading Stream
1 parent 646cdd8 commit cceaf0d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

examples/ble_bluefruit_color_picker.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
ble.stop_advertising()
2323

2424
while ble.connected:
25-
packet = Packet.from_stream(uart_service)
26-
if isinstance(packet, ColorPacket):
27-
print(packet.color)
28-
pixels.fill(packet.color)
25+
if uart_service.in_waiting:
26+
packet = Packet.from_stream(uart_service)
27+
if isinstance(packet, ColorPacket):
28+
print(packet.color)
29+
pixels.fill(packet.color)

0 commit comments

Comments
 (0)