Skip to content

getInt()

CreateiveRobotics edited this page Mar 7, 2020 · 2 revisions
bool getInt(iType &myIvar)

Try and convert the next item in the payload into an int. If the attempt was sucesfull the result will be written to the myIvar variable, and the method will return true.

This will work with signed and unsigned values, and eight, sixteen or thirty two bit ints. The method will first attept to convert the String to an normal int, before casting it to the specific type included in the argument.

example:

int myInt;
if(cmd.getInt(myInt)){
  cmd.print("Success, my int is: "); 
  cmd.println(myInt);
}
Clone this wiki locally