system
1
Hi everyone,
I want to get the binary value of a character in a string and store that in a byte type variable, is it possible? How can I manage to do that?
If I do:
String inputString = "sab";
byte binaryValue = String(inputString[1],BIN));
it does not work...
Thanks in advance,
Alex
KeithRB
2
just use char based traditional c strings and you have it right there, no calculation necessary.
char inputString[8] = "sab";
//...
byte binaryvalue = inputString[1]; // yields 97, the base 10 ASCII value for 'a'
system
3
Oh that's actually easy. Thanks!