Shop OBEX P1 Docs P2 Docs Learn Events
Running Motors through DHB-10 motor controller using serial messages — Parallax Forums

Running Motors through DHB-10 motor controller using serial messages

Hi,

I'm trying to run the motors (https://www.parallax.com/product/28962) with the DHB-10 (https://www.parallax.com/product/28231) using a raspberry pi 2 with python serial messages. I have the wires connected as shown in this post: http://forums.parallax.com/discussion/166289/dhb-10-with-raspberry-pi-3, and my code is as follows:
import serial
import time

def readlineCR(port):
rv = ""
while True:
ch = port.read()
rv += ch
if ch == '\r' or ch == '':
return rv


port = serial.Serial(

port = "/dev/ttyAMA0",
baudrate = 19200,
parity = serial.PARITY_NONE,
stopbits = serial.STOPBITS_ONE,
timeout = 1

)

print('Starting...')

while True:
port.write("GOSPD 32 32\r".encode())
rcv = readlineCR(port)
print(rcv)
time.sleep(0.1)

This all seems to run fine, but the DHB-10 motor lights continue to flash orange and the motors do not move.

Any suggestions to why this is not working?

Comments

Sign In or Register to comment.