How to use Bluetooth hc05 module with Pico

Haven’t been able to get Uart over Bluetooth to work with phone app to control servo motor any one have any suggestions?

1 Like

I found the code that works with the phone app to light up the onboard led

Phone app on google play: Serial Bluetooth Terminal

also to edit the buttons on the bottom of the screen in the app hold down until it open edit macro
and the set name to led on and value to 31 and for off do the same but set value to 30 instead
and to connect Bluetooth go to the 3 lines at the top of the screen and make sure to pair in the normal
Bluetooth menu on your phone too.

Code:

from machine import Pin,UART
uart = UART(0,9600) #RX-->GP0; TX-->GP01
LedGPIO = 25
led = Pin(LedGPIO, Pin.OUT)
while True:
    if uart.any():
        command = uart.readline()
        #print(command)   # uncomment this line to see the recieved data
        if command==b'\x31': #Text '1' = chr(0x31)
            led.high()
            print("ON")
        elif command==b'\x30': #Text '0' = chr(0x30)
            led.low()
            print("OFF")

1 Like

Hi Tim,

Sorry we didnt get back to you sooner!

Glad to hear you got it working :smiley: Looks like a neat app!
While not yet available, you’ll be able to make an interface and host a webserver with the Pico W.

Liam

2 Likes

Here is also a tutorial that may help: Bluetooth Module(HC-05) With Raspberry Pi Pico. : 5 Steps - Instructables

1 Like