How to convert text string to Integer

1. From Arduino Reference Manual--


Figure-1:

2. Description
The toInt() method extract a numerical value from a string of digits; where, the variable myString of Step-1 must be containing a string of digits from 0 to 9.
3. Example

void setup()
{
  Serial.begin(9600);
  
  String myString = "1234";
  int z = myString.toInt();
  Serial.println(z, DEC); //shows: 1234
}

void loop()
{

}

1 Like