String to Int Function
Allows you to convert a String to an integer number.
The toInt() function allows you to convert a String to an integer number.
In this example, the board reads a serial input string until it sees a newline, then converts the string to a number if the characters are digits. Once you've uploaded the code to your board, open the Arduino IDE serial monitor, enter some numbers, and press send. The board will repeat these numbers back to you. Observe what happens when a non-numeric character is sent.
- Arduino Board
There is no circuit for this example, though your board must be connected to your computer via USB and the serial monitor window of the Arduino Software (IDE) should be open.
You can find more basic tutorials in the built-in examples section.
You can also explore the language reference, a detailed collection of the Arduino programming language.
Last revision 2015/08/27 by SM
The Arduino documentation is licensed under the Creative Commons Attribution-Share Alike 4.0 license.