I'm getting data form my computer through UDP and I want to be able to send hex strings to my Arduino convert it to an integer to run some servos. I also want to send data back to my computer in hex.
I'm getting data form my computer through UDP
That looks like?
and I want to be able to send hex strings to my Arduino
Why in hex? Not that it really matters, since the strtol() function can convert a hex string to a long that the Arduino can use.
I also want to send data back to my computer in hex.
The base Print class has overloads of the print() method that take two arguments. The second can be DEC, OCT, BIN, or HEX to define the base, or you can use numbers, if you want base 27 output for some odd reason.
That looks like?
I am ruining 4 servos which I values from 0 to 180.
Why in hex? Not that it really matters, since the strtol() function can convert a hex string to a long that the Arduino can use.
I was wondering about that, I just tried using string.strtol(); it said that it couldn't find it, is that part of another library? If I get it to work if the string looks like this "0xF4" it should work right?
The base Print class has overloads of the print() method that take two arguments. The second can be DEC, OCT, BIN, or HEX to define the base, or you can use numbers, if you want base 27 output for some odd reason.
I know I saw that DEC OCT HEX thing somewhere in the reference. Can that be done with UDP?
I am ruining 4 servos which I values from 0 to 180.
So, why hex? How are the values separated?
I was wondering about that, I just tried using string.strtol(); it said that it couldn't find it, is that part of another library?
It's part of the string library, not the String class. It is a C function.
If I get it to work if the string looks like this "0xF4" it should work right?
Yes, but, again, why hex?
I know I saw that DEC OCT HEX thing somewhere in the reference. Can that be done with UDP?
The UpdClass library does not derive from Print, so, no not directly. You can use sprintf. with the appropriate format specifier to convert a value to a string in hex format, and send that string as a packet.