Bluetooth examples for chapter 9

This commit is contained in:
Danny Staple
2022-06-22 22:30:37 +01:00
parent 115e9e03ef
commit f3d8c7a0d6
24 changed files with 169 additions and 530 deletions
@@ -0,0 +1,21 @@
import board
from digitalio import DigitalInOut
import time
import busio
import supervisor
led = DigitalInOut(board.LED)
led.switch_to_output()
# PICO UART pins? What am i not using?
uart = busio.UART(board.GP12,board.GP13,baudrate=9600, timeout=0.01)
print("Waiting for bytes on UART...")
while True:
data = uart.read(32)
if data is not None:
print(data)
if supervisor.runtime.serial_bytes_available:
value = input().strip()
print(f"Received: {value}\r")
uart.write(value.encode())