The code seems to be ok;
To make it even easier to see, drop the red part.
Code:
IF TK = 1 and LAMP = 1 then 'if TK goes down and LAMP is yet on
IF L15 = 1 THEN 'and we have canceled delay
goto justfade 'so go to fade lamp
else
GOTO delay 'and if delay was not canceled go to delay+fade
endif
ENDIF
and, just use this:
IF TK = 1 and LAMP = 1 then delay
Also, your PWM routine happens so fast that your eyes will not catch the fade effect.
Have a timer loop, say 5ms, in your pwm loop, like "while : wend" and put your pwm pulse inside this "while : wend". Thus, you have a smooth fade effect.
None of these modifications will make your GPIO pin work though.
Just some ideas to make your code better.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks