Hi, what is the correct way to assign a two-character long string to a uint8_t variable? In a way that replicates assigning it like so for example: "uint8_t p1 = 0xb3" (this works obviously) but with a string variable instead.
I so far have tried a few methods and only the current one doesn't return "cannot convert 'String' to 'const char*" errors. That code is below, however it only outputs "0", so I'm clearly missing something. Any help is appreciated, thanks!
Appreciate the response, tried implementing your first recommendation but believe I've done so incorrectly (new code below). It's no longer outputting "0", and is now outputting "179". How should I have correctly written with strtoul? Thanks again:
Oh interesting, appreciate the learning moment. So as far as my uint8_t p1 variable is concerned, is there a difference between what's being stored with my above code versus literally assigning "uint8_t p1 = 0xb3"?