Now i want to know how convert HEX numbers that i received on the serial port by string.
For Example, When i send the request to my module return the music name and nume, this return with this String.
M1+00000008 - MUSIC NUMBER
M2+0000002A - TOTAL NUMBER OF SONGS
MT+000000E4 - MUSIC TIME
MK+00000000 MF+y2mate.com - Daddy Yankee - Gasolina.mp3
This is Hexadecimal numbers.
I already have in my sketch information dividers that separate information by information in specific memory
So I'm resuming my sketch because it's about 5 pages long hahaha
String musicnumber = 0000004F; /// this is a example number, need be a String cuz i'm working with "String.substring" Functions on this code.
void setup() {
Serial.begin (115200)
}
void loop() {
Serial.println () /// How can i do to print "79"
}
I Tried use
lcd.print(strtol("0000004F", NULL, 16));
and this worked!
but when i try use the String "musictime"
lcd.print(strtol(musictime, NULL, 16));
The Log Shows:
exit status 1
cannot convert 'String' to 'const char*' for argument '1' to 'long int strtol(const char*, char**, int)'