Check if UARTService is in waiting before reading Stream
This commit is contained in:
parent
646cdd8afd
commit
cceaf0de1e
1 changed files with 5 additions and 4 deletions
|
|
@ -22,7 +22,8 @@ while True:
|
||||||
ble.stop_advertising()
|
ble.stop_advertising()
|
||||||
|
|
||||||
while ble.connected:
|
while ble.connected:
|
||||||
packet = Packet.from_stream(uart_service)
|
if uart_service.in_waiting:
|
||||||
if isinstance(packet, ColorPacket):
|
packet = Packet.from_stream(uart_service)
|
||||||
print(packet.color)
|
if isinstance(packet, ColorPacket):
|
||||||
pixels.fill(packet.color)
|
print(packet.color)
|
||||||
|
pixels.fill(packet.color)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue