pushbutton, led , potentiometer

Hi guys,

getting into another project, which contain 4 pushbutton and interacting with potentiometer and 4 led.

basically what it does, is that the 4 different led (Red, orange, yellow and green) will light up according to the pushbutton press (stop, orange, green, yellow) and when the potentiometer reach a desired angle i set the led YELLOW will light up, when this part of the code is happening i can't seem to interact it with my other pushbutton eg, when i press stop pushbutton, it will not light up the red led, green will not light up green led and yellow will not light up yellow led

Anyone could tell me why? i am cracking my head trying to figure out where i have gone wrong

Much help appreciated,thank in advance!

No matter what you are doing with the buttons, anglecheck() is going to override the LEDs in a few milliseconds. If pos1degree is between 80 and 99 or between 170 and 189 the orange light will be the only one that stays on for more than a few milliseconds. If that is not how you wanted it to work, what did you want the buttons to do when the pot is trying to set the lights to orange?

johnwasser: No matter what you are doing with the buttons, anglecheck() is going to override the LEDs in a few milliseconds. If pos1degree is between 80 and 99 or between 170 and 189 the orange light will be the only one that stays on for more than a few milliseconds. If that is not how you wanted it to work, what did you want the buttons to do when the pot is trying to set the lights to orange?

i see, how then can i make it in the way that when the pot have reached the angle set , turn on the orange led for indication that desire set point have reach and still possible for it to interact with other buttons after indication?

any advice on how i can do it ?

asfyp: any advice on how i can do it ?

If you keep track of where the pot was last time you checked, and the pot has not moved much, don't set the lights. Only set the lights if the pot has been moved and is in one of the two desired ranges.

johnwasser: If you keep track of where the pot was last time you checked, and the pot has not moved much, don't set the lights. Only set the lights if the pot has been moved and is in one of the two desired ranges.

okay i will try that out! thank you!

Hi,

Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code. It will be formatted in a scrolling window that makes it easier to read.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom... :)