Hello! I am trying to send a hex string through a com port using arduino, I have made a program that works well with RealTerm, it generates a string that I can enter in to RealTerm and it displays the numbers just the way I want it to. But I want the numbers to be sent automatically, without the use of Realterm and I feel like I'm almost at that point but I am very confused right now.
I have gotten to the point where it looks like it's working, it sends hex bytes, but not quite correctly, one byte is missing, and all the values are incorrect, when I try sending "0xA5" it sends "D2" instead of "A5", and I can't find the pattern, why it does that, I've included the code in hopes that some of you guys could help me!
it's not a big program so I included all of it.
the string I send with RealTerm using "Send Number" is this and I want to send it with arduino, I don't know how RealTerm encodes these.
"0xA5 0x68 0x32 0x01 0x7B 0x01 0x10 0x00 0x00 0x00 0x02 0x00 0x00 0x01 0x00 0x00 0x03 0x12 0x00 0x32 0x12 0x00 0x32 0x12 0x00 0x32 0xF9 0x01 0xAE"
in the code I try this
byte sends[29] = {0xA5,0x68,0x32,0x01,0x7B,0x01,0x10,0x00,0x00,0x00,0x02,0x00,0x00,0x01,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xAE};
Serial.write(sends, 29);
sketch_may15a.ino (1.97 KB)