I'm trying to write AT commands to HC-05 module using Raspberry Pi Pico and MicroPython, nothing complicated. But for some reason my module doesn't respond. It works well in data mode and I'm able to send/receive messages from my phone via BT connection.
I've tried doing the same thing but using Arduino and my HC-05 was working. The module is blinking with interval of 2Hz so it's clearly in command mode.
Changing Baud Rate doesn't change anything.
Connecting TX to TX and RX to RX causes the first message to be b'\x00'
, otherwise nothing is returned.
My Code:
from machine import Pin,UART #importing PIN and PWM
import utime #importing time
#Defining UART channel and Baud Rate
uart = UART(0, 38400)
while True:
command = input("COMM>")
uart.write(command)
utime.sleep(1) # to make sure that HC-05 has time to respond
print("checking", uart.any())
if uart.any(): #Checking if data available
data=uart.read() #Getting data
data=str(data) #Converting bytes to str type
print(data)
Ultimately I want to use AT+INQ
to retrieve data about RSSI
of nearby devices.