Working on making a controller for a haunted house prop. Trying to get it to interface with a device.
Was able to use a serial analyzer to see what commands and values are being sent.
the hex codes being sent over serial for manual control is " 40 4d 01" which translates to "@M[?]"
the third byte 01 is the configuration state you want to have it change to. I'm using a byte to store the value between 0-255.
I'm stumped at how to send 2 ASCII characters but in the same Serial.write() command send a raw value, or at how to send them all as hex. I'm sure this is straight forward and I'm just unaware of some simple function.
4d
instead of01001101
... it is just a number ... decimal 7740
hex in ASCII is '@'. You probably send the data correctly if you are usingSerail.write()
but when you read the data withuint8_t incomingByte = Serial.read()
, the return would be in byte(i.e. uint8_t) instead of char, to see the correct HEX, useSerial.print(incomingByte, HEX);
.