String to int
hi, found code snipet converting string int, works great numbers 5 digits after fails.
the code below work if change viewcount "123456" int become negative number.
any ideas?
thanks.
phil
the code below work if change viewcount "123456" int become negative number.
any ideas?
thanks.
phil
code: [select]
viewcount="12345";
char this_char[viewcount.length() + 1];
viewcount.tochararray(this_char, sizeof(this_char));
int newcount = atoi(this_char);
serial.println(newcount);
maybe because int goes 32767. try using long variable , corresponding atol function.
Arduino Forum > Using Arduino > Programming Questions > String to int
arduino
Comments
Post a Comment