(Very much a self-proclaimed noob so please bear with me)
I'm trying to blink an LED to simulate an old incandescent bulb using PWM but want the fade in/fade out part to be a little bit faster than CYCLE = 1 (in the future, I want to use some pots to be able to control this speed on the fly, but I'm not there yet). Is it possible to use values of CYCLE < 1 with PWM and a 12f629?
Code:DUTY VAR BYTE CYCLE VAR BYTE LGHTS_ON_MS CON 1500 LGHTS_OFF_MS CON 500 Cycle = 1 lblLoop: ' Fade in For Duty = 0 TO 255 PWM LED_0, Duty, Cycle Next High LED_0 ' Stay on LGHTS_ON_MS Pause LGHTS_ON_MS ' Fade out For Duty = 255 TO 0 STEP -1 PWM LED_0, Duty, Cycle Next ' Stay off for LGHTS_OFF_MS Pause LGHTS_OFF_MS GoTo lblLoop End




Bookmarks