Skip to content

Instantly share code, notes, and snippets.

@idriszmy
Created May 30, 2022 07:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idriszmy/479befe5c3fa475d785ccd9ef080b880 to your computer and use it in GitHub Desktop.
Save idriszmy/479befe5c3fa475d785ccd9ef080b880 to your computer and use it in GitHub Desktop.
Bluetooth HC-05 master-slave configuration using CircuitPython.
"""
Bluetooth HC-05 master-slave configuration using CircuitPython
Items:
- Maker Pi Pico
https://my.cytron.io/p-maker-pi-pico
- Bluetooth Serial Transceiver HC-05
https://my.cytron.io/p-bluetooth-serial-transceiver-hc-05
- USB Micro B Cable
https://my.cytron.io/p-usb-micro-b-cable
- Grove 4 Pin Buckled to Female Cable
https://my.cytron.io/p-grove-4-pin-buckled-to-female-cable
References:
- https://howtomechatronics.com/tutorials/arduino/how-to-configure-pair-two-hc-05-bluetooth-module-master-slave-commands/
Last update: 30 May 2022
"""
import board
import busio
hc05 = busio.UART(board.GP4, board.GP5, baudrate=38400)
while True:
command = input() + "\r\n"
hc05.write(bytes(command, 'ascii'))
while True:
response = hc05.readline()
if response == None:
break
print(str(response, 'UTF-8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment