Get arduino to accept two different lengths (number of bytes)?

Power_Broker:
Your explanation is quite confusing, but I'm going to take a shot in the dark.

Let's say that that the RPi sends a single 16 bit number (or an Arduino-sized int) to the Arduino one byte at a time and with the MSB (most significant byte) first. If all you want to do is to combine both bytes into a single int, all you have to do is this:

The feeling is mutual on the explanation thing :wink: Cause I am not quite understanding yours either. It just seems like this should be an easy thing to do, you know? So the serial coming in is kind of a constant flow of the same number (that way readSpectrometer keeps running). So RPi sends: 100..... 100..... 100.... Until the RPi program stops and then the user pick something else: 1500.....1500....1500..... (RPi is looping).

I also tried something simple:

while (!Serial.available());
  int inByte = Serial.read();
  

  if (inByte > 3500)  {
    
    digitalWrite(led, LOW);
  }

and it doesn't go through the if (inByte > ..... statement at all.

aarg:
Then you want to read this:
Serial Input Basics - updated - Introductory Tutorials - Arduino Forum

I'll keep reading and trying things out from this.