computer interface

Hey :P, I need help figuring out how to transfer more than 1 byte at a time from my computer to my arduino. I have no problem using when it is just 1 byte but if I want to transfer a value greater than 255 I end up having to divide it in halves or in thirds… Any ideas???

Something like this function will wait for an integer to be sent.

int SerialReadInt() {
  // returns integer value read from the serial port 

   while(Serial.available() < 2 ){   // change this if you don't want to block if data not available
          uint8_t      msb =;
          uint8_t      lsb =;
          return lsb + (msb <<8);

You didn’t say how you are sending the data but the above expects the most significant byte first. You can extend this idea to receiving longs if your values don’t fit into an integer.

Thanks, I haven’t tried that yet but it might work. Right now im using the serial library in processing to send the data