Skip to content

Instantly share code, notes, and snippets.

@smetronic
Created December 17, 2017 11:42
Show Gist options
  • Save smetronic/1f5fc4e0871d08cb73f254a2a5eb78cf to your computer and use it in GitHub Desktop.
Save smetronic/1f5fc4e0871d08cb73f254a2a5eb78cf to your computer and use it in GitHub Desktop.
ATMega 328p: Convert string hex to int
void setup() {
Serial.begin(9600);
String hexstring = "FB";
int number = (int) strtol( &hexstring[0], NULL, 16);
Serial.println(number);
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment