If statements.

I currently have a code to take a reading from an analogue and depending on the value it will light an LED simply.

I currently am using:

 // then do the Play Led
   val = analogRead(analogPinPlay);
   if (val > 400) {
     digitalWrite(ledPinPlay, HIGH);
   }
   else {
     //
     digitalWrite(ledPinPlay, LOW);
    }

I now want to set the value to be a range so that:
value > 400 and less 600.

and tried to write it as

   // then do the Play Led
   val = analogRead(analogPinPlay);
   if (val > 400; val < 600) {
     digitalWrite(ledPinPlay, HIGH);
   }
   else {

but when i verify it the line doesnt work.

Can anyone help me here please :slight_smile:

Thanks in advance.

// then do the Play Led
   val = analogRead(analogPinPlay);
   if ((val > 400) && (val < 600)) {
     digitalWrite(ledPinPlay, HIGH);
   }
   else {

Perfect.

Thankyou very much.