I am trying to convert a string to a double in one of my Arduino projects (specifically using a Teensy 3.5 in the Arduino IDE) using Arduino's string.toDouble()
command. When I try to implement the function as shown in the code below, I get the error:
<'class String' has no member named 'toDouble'>.
However, string.toFloat()
and string.toInt()
work successfully.
Any ideas as to what is going wrong?
String myNumberString = "100";
double myNumber = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
myNumber = myNumberString.toDouble()+1;
Serial.println(myNumber);
myNumberString = String(myNumber);
delay(1000);
}