DIRS
tedroberson9
Posts: 5
I want to control outputs P13,14,and 15 to manually switch 3 LEDs on and off sequentially, using momentary switches at in2,3 and 4. as control source. LED 1 is on by default. Pushing any switch after activation should turn on corresponding LED, turn off all others. I've tried using the DO LOOP,IF...then... else but not quite what I need, each time the loop cycles the led blanks; I need solid on and off. How do I setup the DIRS and IN to achieve this?????HELP!!!!!!!
Comments
"What's a Microcontroller?" has code examples for working with various switches and other code examples deal with turning something like an LED on and off. Nuts and Volts Column #6 shows how to use a transistor to turn a relay or motor on and off. Column #6 is in Volume #1.
HIGH 15 (red LED ON)
DO
IF IN3=(1) THEN LOW 15: HIGH 14:LOW 13:ENDIF ( Green LED ON) ( Red and yellow LED OFF)
IF IN4=(1) THEN HIGH 13: LOW 14:LOW 15:ENDIF ( Yellow LED ON) ( Red and green OFF)
IF IN5=(1) THEN HIGH 15: LOW 14:LOW 13:ENDIF (Reset)
LOOP
Thanks again.