Skip to content

Instantly share code, notes, and snippets.

@smetronic
Created August 31, 2019 19:45
Show Gist options
  • Save smetronic/8f925fd1db78ec07a542490dd9dc039b to your computer and use it in GitHub Desktop.
Save smetronic/8f925fd1db78ec07a542490dd9dc039b to your computer and use it in GitHub Desktop.
Send byte data over serial connection
uint8_t b[]= { 0xE0, 0x10, 0x82, 0x00, 0x01, 0xE2, 0x00, 0x00, 0x19,
0x10, 0x10, 0x01, 0x05, 0x18, 0x30, 0x49,
0xD8, 0x03 };
int i;
void printHex(uint8_t num) {
char hexCar[2];
sprintf(hexCar, "%02X", num);
Serial.print(hexCar);
}
void setup() {
Serial.begin(9600);
}
void loop() {
for(i=0; i<sizeof(b); i++){
printHex(b[i]);
}
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment