Check if UARTService is in waiting before reading Stream

This commit is contained in:
Nina Zakharenko 2020-06-13 22:59:12 -07:00
parent 646cdd8afd
commit cceaf0de1e

View file

@ -22,6 +22,7 @@ while True:
ble.stop_advertising()
while ble.connected:
if uart_service.in_waiting:
packet = Packet.from_stream(uart_service)
if isinstance(packet, ColorPacket):
print(packet.color)