2

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?

asked Sep 3, 2016 at 2:20

2 Answers 2

1

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

answered Sep 3, 2016 at 21:25
0

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)
answered Jun 10, 2022 at 23:42

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.