Hi,
I’m trying to extract data that I send to a bluetooth module (DSDtech HM-19) but the problem is that if I send a number, the one received by the arduino isn’t the same. If I send 1, the arduino receives 49 or if I send 22 the arduino receives 5050. It appears to be ASCII code but I can’t find a way to convert it if it is more than a simple number ( - ‘0’). Is there a function or something to do this ?
Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'
Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination
You could convert each character as it is read instead of trying to convert a multi digit number all at once
Or you could put each character in an array of chards as it is read, add a '\0' to the end to turn it into a C style string then use atio() to convert it to an integer
Or you could use Serial.parseInt() to do teh job for you