Created
August 31, 2019 19:45
-
-
Save smetronic/8f925fd1db78ec07a542490dd9dc039b to your computer and use it in GitHub Desktop.
Send byte data over serial connection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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