analogue range


hi, first post, i've been battling on , off day (second day arduino/coding sorry) i'm hoping 1 of can me. i'm sure simple i've been through heaps of other project code , done google searches , i'm @ point want tell me answer...

i've got pot set on pin a0, getting feedback nicely on serial monitor. want light pin 13 when pot within range of numbers, 900-1000, stay low when it's anywhere else. came workaround i'm sure you'll laugh @ :) want more simple way of getting work:

  if (sensorvalue > 1001)
    {digitalwrite(led, low);}
  else if (sensorvalue < 900)
    {digitalwrite(led, low);}
  else digitalwrite(led, high);

as can see have defined outlying numbers low , else high. want define area want high (900-1000) , else low, if that's possible, otherwise tell me i've done way.

code: [select]
if(sensorvalue  >= 900 && sensorvalue <= 1000)
{
   // turn led on
}
else
{
   // turn led off
}


Arduino Forum > Using Arduino > Project Guidance > analogue range


arduino

Comments

Popular posts from this blog

VIDIOC_S_FMT error 16, Device or resource busy - Raspberry Pi Forums

using a laptop skeleton to build a pi laptop - Raspberry Pi Forums

Forum for Joomla? - Joomla! Forum - community, help and support