problem with reading Position Controller Kit (#27906)

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

Comments

  • With the propeller code you can define the single pin as half duplex so that you can send a command with this pin and then turn around and receive the value back on that same pin.

    So the Rx is also the Tx pin in this configuration.

    Mike
  • iseries wrote: »
    With the propeller code you can define the single pin as half duplex so that you can send a command with this pin and then turn around and receive the value back on that same pin.

    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.
  • Try the circuit I posted for the ColorPAL here:

    http://forums.parallax.com/discussion/comment/890040/#Comment_890040

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • Try the circuit I posted for the ColorPAL here:

    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.
  • Try the circuit I posted for the ColorPAL here:

    http://forums.parallax.com/discussion/comment/890040/#Comment_890040

    -Phil

    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
  • Just remember, everything you send from the Arduino gets echoed back to it, so your program has to ignore those commands before the actual response comes back.

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
Sign In or Register to comment.