Asked — Edited
Resolved Resolved by thetechguru!

Uart Compass

Hi Guys, I want to hook up my Sure Compass to UART and the manual says to send all commands in ASCII. I know how to convert text to ASCII but I am stumped as to how to put it into the UART commands in ARC script. Has anyone done this? I have seen and read the info on I2C in reference to the Compass but can't find anything on using UART.



Upgrade to ARC Pro

With Synthiam ARC Pro, you're not just programming a robot; you're shaping the future of automation, one innovative idea at a time.


Hi @Bookmaker32, there's an example built into ARC to do two way UART communication.

Check under: Examples -> EZ-Script Function Syntax -> UART peripheral

Hope that helps!


I have done all that and I am totally aware of the UART examples but my question is how do you write ASCII in the data area of the command. uartwrite(0,0,036 115 117 114 101 032 103 097 013 010) that won't work. Justin, you mentioned serial. How would that look?


I doubt the instructions are talking about ASCII code, probably just means to send as text. Do you have a link to the compass manual?




the manual is in my first post

doh.... Teaches me to read the forum and try to work at the same time.

I'll take a look.



OK. I am pretty sure they were meaning Ascii as synonymous with text, so you would just send text (since their example shows just entering the text) . Otherwise, if you really need to force ASCII encoding, then prefix each with 0x ie.

0x036 0x115 0x117 0x114 0x101 0x032 0x103 0x097 0x013 0x010

except in the uartwrite command you probably will need to add 0x0d, 0x0a to the end of the line for the required CR/LF whether or not you can send text or need to ASCII convert.



@thetechguru, many thanks. I am at work so I can't play with it right now but I am sure that will solve the issues I have been having.


$ x=GetAsByte ( value )

This will convert the data to the ASCII character. I had to use the same protocol to communicate with my Dynamixel servos. In Phython its chr ( value ).


@mtiberia, Thank you for the input but I am a novice when it comes to coding so if you don't mind can you expand a bit on exactly what to do. The manual says to send "$sure ga " to get the direction. How would that look in script? I am feeling really inept.