I am trying to hook up a HM-10 module to my raspberry pi pico w to be able to send bluetooth signals via my iPhone 14 pro max. I am wiring it as the diagram says I am and I have coded it as the following.
Code: Select all
import board
import digitalio
import time
import busio
led = digitalio.DigitalInOut(board.GP28)
led.direction = digitalio.Direction.OUTPUT
uart = busio.UART(board.GP0,board.GP1,baudrate=9600)
while True:
data = uart.read(32)
if data is not None:
data_string = ''.join([chr(b) for b in data])
if data_string=='1':
led.value = True
uart.write('on')
if data_string=='0':
led.value = False
uart.write('off')