problem with reading Position Controller Kit (#27906)
willcr
Posts: 4
Hello people. I am working with a robot that uses Position Controller Kit and the HB25 where I have to move and control the robot using an Arduino Mega.
At the moment, I can send commands to the encoder without problems. As an example of TRVL where I can send the command and my wheels spin as expected. My biggest problem is reading the encoder using QPOS. I send the QPOS statement but cannot read an answer using Arduino RX since the encoder uses 1-wire UART. I would like to know if anyone has any solution I can use to read the encoder.
Thankful,
William
At the moment, I can send commands to the encoder without problems. As an example of TRVL where I can send the command and my wheels spin as expected. My biggest problem is reading the encoder using QPOS. I send the QPOS statement but cannot read an answer using Arduino RX since the encoder uses 1-wire UART. I would like to know if anyone has any solution I can use to read the encoder.
Thankful,
William
Comments
So the Rx is also the Tx pin in this configuration.
Mike
Hello, thanks for replying.
How could I do this pin setting for half duplex? Because as I am using it I use arduino TX to send the command and RX to read it.
http://forums.parallax.com/discussion/comment/890040/#Comment_890040
-Phil
Hello, thanks for the reply.
I will ride the circuit and test it, hope it works. I will comment here on the results.
I performed the tests with the circuit, it sends the codes perfectly but reading I end up reading values that do not make sense. Maybe that's the way I'm reading it. I'll show you how I'm doing it below:
Serial1.write(0b00001000);
while (Serial1.available() > 0) {
XH = Serial1.read(); //Read RX1 Arduino Mega
XL = Serial1.read(); //Read RX1 Arduino mega
Serial.println(XH); //Print Serial monitor
delay(10);
Serial.println(XL); //Print Serial monitor
}
-WIlliam
-Phil