
Originally Posted by
mackrackit
Add a bit of code and schematic for basic use....
Ok.
I attached the schematics to this post. The code is pretty simple. It uses only one pin in the PIC to create four states in the red-green LED. You can get Red, Green, Yellow, or the Off state in the LED using only one pin. Of course, for getting the last state (Off) all the credit goes to mackrackit. He figured that one out
.
Code:
START:
HIGH PORTB.0 'Turn on red light
PAUSE 2000
LOW PORTB.0 'Turn on green light
PAUSE 2000
FOR I = 1 TO 2000 'Obtain a yellow light
TOGGLE PORTB.0
PAUSE 1
NEXT I
TRISB.0 = 1 'Turn off LED
PAUSE 2000
GOTO START
Bookmarks