I have a trex jr. I am a little confused on the set configuration parameter command. From the user guide I see:
“0xAF: … This command takes four data bytes and returns one byte. The data bytes are …parameter # parameter value (7-bit representation) 0x55 (format byte 1) 0x2A (format byte 2)”
I don’t understand what format byte 1 and 2 mean?
I want to set the motor mode. So in extended mode and assuming default configuration i send :
0x80, 0x07, 0xAF, 0x7B, 0x01
Which has only 2 bytes not 4. So am I supposed to send 0x55 and 0x2A? at the end? Like this?
0x80, 0x07, 0xAF, 0x7B, 0x01, 0x55, 0x2A
So, can you tell me what I need to send to make it go into single motor mode?
Yes, when sending the Set Configuration Parameter command, the last two bytes must be 0x55 and 0x2A. These format bytes make it much less likely that a random stream of serial bytes sent to the TReX Jr will inadvertently change the settings.
Your understanding of the expanded protocol isn’t quite right, however. When using the expanded protocol, the command byte must have its most significant bit cleared, so 0xAF becomes 0x2F. If you only have one TReX Jr on your serial line, then you can just use the compact protocol:
0xAF, 0x7B, 0x1, 0x55, 0x2A
If you have multiple devices on the line, you should first make sure they have separate device IDs, and then you would send:
0x80, device ID, 0x2F, 0x7B, 0x1, 0x55, 0x2A
Note that you will need to reset the TReX Jr after sending this command in order to make the configuration parameter change active.