
mtiberia
There is an issue when sending ASCII code through the UART ports. For some reason the ASCII code is getting lost in the translation. It is hit or miss, some codes make it through fine and some don't get sent at all. Error saying that the expression is not in quotes. If the code is sent the received transmission shows a question mark. I have included an example with the ASCII code 255, it gets sent but RX is a ? and not the y with two dots above it.
If you can correct this issue with the scripting you would have me sold on the EZ B.
Great platform and fun to use.
Thanks DJ
Start 1: UARTInit(0,1,1000000)
7: $handshake=GetAsByte(255) # ASCII code 255
8: UARTWrite(0,1,$handshake) # not all codes will be TX
10: Print($handshake)
ÿ # symbol that code represents
14: Sleep(1000)
16: $x = UartAvailable(0, 1)
18: print("Bytes in buffer: " + $x)
Bytes in buffer: 1
20: $TX_DATA = UARTRead(0, 1, $x)
22: print("Received: " + $TX_DATA)
Received: ? # RX Issue or TX issue
25: Print ("done")
done
@DJ.... For clarification you only need to call UARTInit once per ARC session?.... Is there a timeout or will it stay initialized until you close out your ARC session?
The UARTInit() will initialize the UART until the EZ-B v4 has been power cycled
@DJ .... Sweet...helps to make my code more efficient..... Love leaning new stuff about the ezb...
I don't want to keep beating a dead horse but for my peace of mind could you two guys try this example and let me know what you RX.
I have a jumper wire connecting D5 and and D6.
Try substituting different values in the $test.
UARTInit(0,1,1000000)
$test1=GetAsByte(125) $test2=GetAsByte(180) $test3=GetAsByte(75) $test4=GetAsByte(255)
$data=$test1+$test2+$test3+$test4
UARTWrite(0,1,$data)
$x = UartAvailable(0, 1)
print("Bytes in buffer: " + $x)
$RX_DATA = UARTRead(0, 1, $x)
print("Received: " + $RX_DATA)
Print(GetByteAt($RX_DATA,0)) Print(GetByteAt($RX_DATA,1)) Print(GetByteAt($RX_DATA,2)) Print(GetByteAt($RX_DATA,3))
What do you expect $data to look like when you do this?
Tell me what you expect to see in $data?
Do you expect to see many bytes? Or do you expect to see the values of each variable added together?
The $data should come out as a list with 125,180,75,and 255. It just saves typing a separate line for each value and sending it.
Even if I send the data one at a time a still don't RX the proper value.
I'm sorry I used python to send data to the Dynamixel servos and Arduino nano. and it is working.
In all programming languages, that will add the values together into one value. Only strings can be appended with the + symbol. (including Arduino, which uses C++)
String example
Math example...
What do you think $z would equal in each example?
I understand but did you try running the script ? What values are you RX in your console ?