If you send the number as a string then you can use the atoi() function to convert the string to an integer.
I can't remember if there is a size limit to the integer you can get this way.
atoi() is a standard c function that is not documented in the Arduino reference. Google it to see the syntax.
atoi() will add quite some bytes to the size of your sketch though.
Edit: check this thread: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1176289764
Thanks for this but I'm not sure why I would need to convert a string to and integer in this instance since I am not sending a string(that i am aware of) from pyserial. I am sending ASCII(which is represented in characters) but it seems that when it is read into the arduino it comes in as the same number I sent.
pySerial command in a python shell for sending
Arduino command for receiving Data
startbyte = Serial.read();
The startbyte variable in the Arduino code, behaves as though it's holding the value I sent from python (255). So the relationship is 1 for 1 (or in this case 255 for 255).
This is good and what I want to happen. Only sending the values as ASCII means I can only send a number no higher than 255.
This is the limit for ASCII which is also the maximum number you can reconstruct from one byte(apparently).Here is where it all gets a bit blurry for me...
Say I wanted to send a value from python which is 2555. I'm sure there are all sorts of ways to do this with the current ASCII encoded approach.
Like sending the ASCII Character for 2 then 5 then 5 then 5.
Or, send 25 then 55. Then rebuild these numbers back to the whole number in the Arduino code. But this feels like a cumbersome approach correct?
I'm thinking that there must be some way to get the whole binary number for 2555, then maybe split that into the minimum amount of bytes needed to send it over serial (one byte at a time) then rebuilt the bytes back into one whole binary number, then convert that into the original 2555 number that was sent from pySerial.
Can anyone tell me if I'm on the right track? Sorry for rambling, I am just thinking out aloud. :-/