OldBotBuilder
USA
Asked
— Edited
Resolved by DJ Sures!
I am trying to interface my Robotics Bioloid to the EZ-Bv4 using UART 0 to transmit/receive the 5 word Comm packet; FF 55 Data_l ~Data_l Data_h ~Data_h ~ represents Inverse (1's Complement), Data_l is the least significant hex value, Data_h is the higher significant hex value the Robotis boomerang controller sends when a button is pressed. For example: FF 55 01 FE 00 is the value 01 (button U) FF 55 00 FF 01 is the value 256 (Hex 10) (button 5)
I can not get the new UartReadRinary, UartWriteBinary to work correctly.
Is there to be a tutorial on the use of the Uart script functions? Thanks for any help.
Here is an example that will help you...
Thanks DJ.
I get the general idea you show for writing to the Uart. What about UartReadBinary?
BTW - Thanks for the very quick response!
Read Binary puts the data into the provided Array Variable - there is EZ-Script help with an example
I am a lot closer but still having problems:
After a power cycle and 'connect' I start the get hex data script and hit button 5 I get this:
and a RealTerm monitor connected to the RX of EZ-B4 shows this:
Problem 2) RealTerm shows the HEX data but the script produced decimal data.
Here is the script:
You don't have to bother using hex. Just use decimal values, the Bioloid uses unsigned integers 0 to 255 to communicate.
if you convert the hex to the decimal value you'll see the same values.
I discovered this when trying to control the dynamixels with python.
What is the meaning of $x is in your code sniplet...
Because you are not using $x anywhere - and the Read Binary is hardcoded to a value of 6 characters. This means you are 100% certain there is 6 characters available? You cannot be 100% certain without actually checking. So hardcoding a value of 6 is why you're program is crashing. You're requesting more information than what is available.
Perhaps something like this will make more sense...
DJ, Thanks again.
Works like a champ! Also gave me better understanding of how the script function operates.
Now I am ready to 'UartWriteBinary'.
Woo! your progress is impressive