Thank you for your help with the code. I went a little further and added a right to my code to go along with my left, so now I have two LEDs.
I tried the following code:
-------------------------------------------------------------------
osccon = %01100000
ansel = 0
cmcon0 = %00000111
trisa = %11111111
trisc = %00000000
portc = %00000000
left var porta.0
right var porta.1
loop:
if left then
portc.0 = 1
pause 2500
portc.0 = 0
porta.0 = 0
left = 0
endif
if right then
portc.1 = 1
pause 2500
portc.1 = 0
porta.1 = 0
right = 0
endif
portc.3 = 1
pause 120
portc.3 = 0
pause 120
goto loop
end
-------------------------------------------------------------------
The Result:
when porta.0 is triggered, portc.0 turns on 5 times
when porta.1 is triggered, portc.0 turns on 1 and then portc.1 turns on 4 times
Questions:
1. why is it doing that? I just want it to light up once.
2. is there a way I can have two ports light up at the same time? (i.e. porta.0 and porta.2 turn on at the same time if I add more LEDs) what I get when that happens is only one turns on at a time.
I look forward to your reply and thanks for your help again.
Bookmarks