Ive connected an hm10 ble to my raspberry pi 2 GPIO pins (3.3V, GND, Rx and Tx).
I've changed the cmdline.txt to 9600 and the inittab is empty. I downloaded raspbian about 1 week ago.
Im running this python script on the raspberry pi 2 to try and send commands to the ble module. I cant get the module to respond:
#!/usr/bin/env python
import serial
ser = serial.Serial('/dev/serial0',9600,parity=serial.PARITY_NONE,stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS,timeout=None)
while True:
ser.write("AT")
data = ser.read()
ser.write(data)
I just get an empty prompt and no response in terminal. What am I missing?
2 Answers 2
Got it working. Ended up posting the answer on my original raspberry.org forum post here: https://www.raspberrypi.org/forums/viewtopic.php?f=91&t=158856&p=1032763#p1032763
Basically I had to change AT+IMME = 1
try this out
import serial
ser = serial.Serial('/dev/ttyUSB2',9600,parity=serial.PARITY_NONE,stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS,tim>
while True:
ser.write(bytes("AT\r\n", 'utf-8'))
data = ser.read()
print(data)