[SOLVED] "byteRead+1" Not working

I would like to send a number over using the Serial Monitor then have that number blink the corresponding LED. It was going well until the "byteRead+1" bit decided not to work. So if i sent a 2 then it would add 1 and then blink the LED on pin 3. However it just doesn't blink any of them!

If I change the "If 0 then all off" bit to turn them on instead then that works fine, if i send a 0 then they all turn on. So the data is definitely being received and acted on accordingly for the most part.

I can also change the "byteRead+1" to a pin number then if i send any number greater than 0 that pin will light up.

I'm using an Arduino Uno

Any help would be greatly appreciated!!

/* This program was created by ScottC on 8/5/2012 to receive serial 
 signals from a computer to turn on/off 1-9 LEDs */

void setup() { 
  // initialize the digital pins as an output.
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(13, OUTPUT);
  // Turn the Serial Protocol ON
  Serial.begin(9600);
}
void loop() {
  byte byteRead;
  /* check if data has been sent from the computer: */
  if (Serial.available()) {
    /* read the most recent byte */
    byteRead = Serial.read();
    //You have to subtract '0' from the read Byte to convert from text to a number.
    byteRead=byteRead-'0';
    //Turn off all LEDs if the byte Read = 0
    if(byteRead==0){
      //Turn off all LEDS
      digitalWrite(2, LOW);
      digitalWrite(3, LOW);
      digitalWrite(4, LOW);
      digitalWrite(5, LOW);
      digitalWrite(6, LOW);
      digitalWrite(7, LOW);
      digitalWrite(8, LOW);
      digitalWrite(9, LOW);
      digitalWrite(13, LOW);
    }
    //Turn LED ON depending on the byte Read.
    if(byteRead>0){
      digitalWrite((byteRead+1), HIGH); // set the LED on
      delay(1000);               // wait for a second
      digitalWrite((byteRead+1), LOW);    // turn the LED off by making the voltage LOW
      delay(1000);
    }
  }
}

If you can read data sent from the Serial Monitor application, then you should be able to write data to the Serial Monitor application.

Make use of that capability to debug your program. You send a '3'. What do you receive? What do you get after subtracting '0' from it?

I don't see anything wrong with the code, except the piss-poor indenting. Tools + Auto Format BEFORE you post code.

you may know this but because Serial.read() picks up only the first byte of incoming serial data ...

byteRead = Serial.read();

you will have trouble trying to lite this led

digitalWrite(13, LOW);

with your code. You may end up having to process more incoming data or using an array to get the value for the 13 pin, FYI

BulldogLowell: you may know this but because Serial.read() picks up only the first byte of incoming serial data ...

byteRead = Serial.read();

you will have trouble trying to lite this led

digitalWrite(13, LOW);

with your code. You may end up having to process more incoming data or using an array to get the value for the 13 pin, FYI

That's it!!!!! Can't believe I didn't realize that!!! Thank you so much :)