Hello everyone!
I have spent the last 8 hours trying to solve this but I just can't. What I am trying to do is convert a simple numeric value that is scraped from the web using "char c = client.read()" to integer and I just can't get it to work. The atoi() function does not like the fact that the variable 'c' has been initiated to client.read(). Any help would be much appreciated. My code:
void loop() {
// if there's incoming data from the net connection.
// send it out the serial port. This is for debugging
// purposes only:
char c;
if (client.available()) {
c = client.read();//////The arduino is grabbing the value from the text file
Serial.print(c);
if (c>10){
digitalWrite(3,1);///If c > scraped value, LED ON
}
else
{
digitalWrite(3,0);
}
}
How can I most efficiently convert "c" to an integer like (56) that it is pulling. The most frustrating thing is that on the Serial Monitor, the value shown is exactly "56" but my logic for LED does not work. Again, any help appreciated.
PS: I have tried to search through the forums and didn't find help. I have seen a lot of folks get irritated at questions about how to use atoi() but I couldn't find a defacto example using client.read() and all other example are vague at best.