
Originally Posted by
elen-group
Our circuit is not conditioned to the switch. Everytime we turn on the circuit our led comes on regardless if we use the switch or not. We tried the suggested help but still did not fix it. I am thinking that there is some issue with the if statement which is not implementing the switch we want.
Code:
DEFINE OSC 20
PortA = %00000000
TRISB = %00000000 'setup PORTB; 0 for output, 1 for input
TRISA.0=1
loop:
IF PORTA.0 = 1 Then ledon
PORTB.0=0 'turn off LED
GOTO loop
ledon:
PORTB.0=1 'light LED
PAUSE 5000 'pause for 2 seconds
PORTB.0=0 'turn off LED
GOTO loop
END
put a pulldown resistor on porta.0
and a pullup on PortB.0
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks