Hello all it is my first post and I would be eternally gratefull if somebody can spare a bit of time to give me a hand.
my code is
unsigned int i = 0; //timeout counter
//declaring strings for incoming data
String outputString1 = "";
String outputString2 = "";
while (!Serial.find(""field1":")){} // find the part we are interested in.
while (i<60000) { // 1 minute timeout checker
if(Serial.available()) {
char c = Serial.read(); // reading from serial port for outputString
if(c==',') break; // break out of our loop because we got all we need
outputString1 += c; // append to our output string
i=0; // reset our timeout counter
}
i++;
}
I can not for the life of me to declare outputString as a number.
what I get from Serial.read will be either a "1.000" or "0.000".
thats why I am using Strings.
How can I either Serial.read to a number (int, long or whatever) or convert the characters to an int or long or float preferably an int would be great!
Cheers and thankfull for your time