Parsing a negative integer from a string - Processing2


hi guys,
i trying obtain integer string in processing2.

my arduino code sending string via serial port ;
the string "-1" , processing taking string.
now in processing2 need parse string transform integer number.

no problems when obtaining positive values when need obtain negative values troubles begin!


ok here have:

int myvalue = 0;
string mystring = "";


in main loop:

myvalue = int(mystring );
or
myvalue = parseint(mystring);

i repeat, if integer value positive no problems , program working if integer value need negative seems parse command can't understand minus symbol... "-1" can't handled making program crash.

what need  parse negative number string "-1" ???

i getting mad!




look here better understanding of parseint



Arduino Forum > Using Arduino > Programming Questions > Parsing a negative integer from a string - Processing2


arduino

Comments