Is there something like bool TryParse(char someint, out int someOtherInt) in Arduino?
If it is, in what library i can find it?
I found some examples to test Strings that way, but i personaly preffer check it directly, specialy because i'm taking input from the console
Arduino UNO
Windows 10
Here is the code:
void setup() {
Serial.begin(9600);
}
void loop() {
if (Serial.available())
{
recvOneChar();
showNewData();
/*byteRead = someInt = Serial.read();
Serial.write(byteRead);
Serial.print("I received: ");
Serial.write(someInt);
Serial.print(" this has an ASCII value of ");
Serial.println(someInt,DEC);*/
if(Serial.parseInt()){
if(((someInt) > 0) && ((someInt) < 89))
{
KeyNotesNode.add(someInt-48);
Serial.print("It is a number!");
Serial.print(someInt-48);
}
}
Serial.println("");
}