Hello, I am using the ethernet shield on an Arduino 328. Using the standard example that comes with it I have managed to get my code to control my Arduino from a webpage. I do this by parsing the URL that is returned, but by parsing, I end up with a set of strings. What I need is a value that I can do something with.
Say my URL is "10.0.1.177/?bpm=120"
I am currently parsing this with:
if(inString.contains("bpm")){
int first = inString.indexOf('m');
int second = inString.indexOf('H');
Serial.print("Setting rate to ");
for (int i = (first + 2); i <= (second - 1); i++){
Serial.print(inString.charAt(i));
bpm.append(inString.charAt(i));
}
Serial.print("bpm:");
Serial.println(bpm);
}
This does a nice job of retrieving the correct rate (120 in this case) but what I need to do is use that number. It isn't a number at this point, it is a string.
Does anyone have an idea of how I can either retrieve this value as a number or convert it from a string into a number?
Thanks!
R