hi
I want to write some HEX into arduino serial to be able to send command to relay board.
I have tried many ways with no success, I cant understand why...
this is my code
I contacted the support on how to send command and their response was
on your Arduino simply write these bytes out the serial port connected to the module:
254 108 1
This will turn on relay 1 on the board.
also they said, these commands are in ascii.
I could not find a way to send the ascii.
so I tried to send the command in Hex, I searched on the net to find the example I posted earlier.
I can see there is a LED light flash when there is Serial.print , but I still cant make the board response
and I have sent the command 254 108 1 on X-ctu terminal, but with no result
but when I sent "FE 6C 01" in the terminal it works perfectly
I still dont under stand why sending HEX is not working
hamzehhirzallah:
but when I sent "FE 6C 01" in the terminal it works perfectly
Are you sending the ASCII characters "F", "E", "6", "C", "0", "1" or their numerical equivalents via some escape code in your terminal?
Is there a possibility that the baud rate on the Arduino is wrong?
Have you tried connecting your Arduino to your terminal, receive the data from the terminal into the Arduino and look at exactly what's being sent out?
Also, the Print.cpp library (which handles all the .print and .println calls) is wacky in the way it handles signed vs. unsigned characters.