Need some guidance please...
Working with my girl on a school project and we want to simulate a star in the sky. Trying to; run a LED @ 50% the whole time and to be able to give it a quick flash @100% as needed for the effect.
Something to try is PWMOUT which can be varied for greater effect and then also have another pin to the LED through a diode where you turn that pin on and off with PULSOUT - with another resistor in series as well [i.e. 270 ohms in series with PWMOUT pin and say 150 ohms and a diode in series with the PULSOUT pin both to the same LED + pin with its - pin to V-]. RANDOM can be used for irregular twinkle times to trigger the PULSOUT flash.
At the PWMOUT speeds likely diode type doesn't matter much - mainly the diode voltage drop is your consideration - schottky diode has lowest voltage drop... I was assuming the pin drive current was all that was needed - if you have need for bigger current output than 20ma then use a LL MOSFET or two...
This program will flash the LED at a random time between 100 and 755 mS delay between flashes
The minimum brightness of the led can be set by experiment and the duration of the flash can be set by the
I tested the program with a standard LED.
' 08m2 program for star simulation
w1 = w0/100 + 100 'Range between 100 to 855 mS
pwmduty c.2, 20 'this value is set for min dim level. Found be experiment.
pause w1 ' random on time of minimum level
pwmduty c.2,400 ' led max ON
pause 20 'value in mS 100% LED on time.