hi, first post, I've been battling with this on and off for the day (second day with the arduino/coding sorry) so I'm hoping one of you can help me. I'm sure this is simple but I've been through heaps of other project code and done some google searches and now I'm simply at the point where I want someone to tell me the answer...
I've got a pot set up on pin A0, getting the feedback nicely on the serial monitor. I want to light up pin 13 when the pot is within a certain range of numbers, say 900-1000, but stay low when it's anywhere else. What I came up with was a workaround that I'm sure you'll all laugh at so I want a more simple way of getting it to work:
if (sensorValue > 1001)
{digitalWrite(LED, LOW);}
else if (sensorValue < 900)
{digitalWrite(LED, LOW);}
else digitalWrite(LED, HIGH);
as you can see I have defined the outlying numbers as low and everything else as high. I want to define the area I want as high (900-1000) and everything else as low, if that's possible, otherwise just tell me what I've done is the only way.