Hi there,
I am new to this worl of pics, and know very little about them. I started this as a new hobby, and got really into it.
At the moment, I am having difficulties to make my pic count upto 3 presses of a switch connected to pin 2, and turn off a led connected to pin 1.
Please any advice will be much appreciated.
Best regards.
Frank.
Code:
cnt VAR BYTE
boton VAR GPIO.2
mosfet VAR GPIO.1
CMCON = 7
'Ports
Output mosfet
Input boton
cnt=0
boton = 1
'Begin Program
TEST:
high mosfet
count 2, 1, cnt
if cnt = 3 then
cnt = 0
low mosfet
pause 1000
endif
GOTO TEST
end
Bookmarks