Code:
Red var GPIO.0
Green var GPIO.1
Blue var GPIO.2
SwitchPin var GPIO.3
ButtonCount VAR BYTE
ButtonCount = 1
;Make sure LEDs are off
HIGH Red
HIGH Green
HIGH Blue
MAIN:
IF SwitchPin THEN
If ButtonCount = 1 THEN GOSUB RedProgram
If ButtonCount = 2 THEN GOSUB GreenProgram
If ButtonCount = 3 THEN GOSUB BlueProgram
If ButtonCount = 4 THEN ButtonCount = 1
ButtonCount = ButtonCount + 1
endif
GOTO MAIN
RedProgram:
PWM Red,127,100
RETURN
GreenProgram:
PWM Green,127,100
RETURN
BlueProgram:
PWM Blue,127,100
RETURN
Code:
Red var GPIO.0
Green var GPIO.1
Blue var GPIO.2
SwitchPin var GPIO.3
ButtonCount VAR BYTE
ButtonCount = 1
;Make sure LEDs are off
HIGH Red
HIGH Green
HIGH Blue
MAIN:
IF SwitchPin THEN
If ButtonCount = 1 THEN
PWM Red,127,100
ENDIF
If ButtonCount = 2 THEN
PWM Green,127,100
ENDIF
If ButtonCount = 3 THEN
PWM Blue,127,100
ENDIF
If ButtonCount = 4 THEN ButtonCount = 1
ButtonCount = ButtonCount + 1
endif
GOTO MAIN
Bookmarks