INCLUDE "bs1defs.bas"
DEFINE OSC 4
cnt VAR BYTE
delay var byte
boton VAR GPIO.2
led VAR GPIO.1
ANSEL = 0 '12F675 for test
CMCON = 7
OPTION_REG.7= 0 'Pullups enabled
WPU = %00000100
steps VAR WORD
cycles CON 2
cnt = 0
GPIO = %00000110 ' Nosurprise startup ...
TRISIO = %00000100 ' GP2 as input and set GP 0,1,3,4,5 as outputs
'************************************************* *****************************
Detect: 'Button presses W/Debounce
'
delay = 0
BUTTON Boton ,1,255,0,delay,0,pressed
'Pin,Down,Delay,Rate,BVar,Action,Label
' Slow Things down
GOTO Detect
'************************************************* *****************************
Pressed: ' Some > 10ms press detected
IF cnt <=1 Then 'tocount uptu 3, bigger values will add up.
cnt = cnt + 2
ELSE
cnt = 0
For steps=0 TO 100
PWM led,steps,cycles
Next
'in here what can i type in order the LED to stay at the specific brightness???
ENDIF
WHILE !Boton : WEND ' Wait Boton release !!!
goto detect
END
Bookmarks