​ ​ ​ ​ twinkle little star
Results 1 to 7 of 7

Thread: twinkle little star

  1. #1
    Member
    Join Date
    Mar 2014
    Location
    maryland
    Posts
    64

    Default twinkle little star

    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.
    Dave

  2. #2
    Senior Member
    Join Date
    Jan 1970
    Location
    Colorado USA
    Posts
    3,078

    Smile

    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.

  3. #3
    Senior Member
    Join Date
    Apr 2013
    Location
    north dakota
    Posts
    324
    Blog Entries
    2

    Default

    @ premelec ....thats a good idea ... would a schottky diode work with that speed or would you use a normal one?
    I might give it a try

  4. #4
    Senior Member
    Join Date
    Jan 1970
    Location
    Colorado USA
    Posts
    3,078

    Default

    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...

  5. #5
    Technical Support
    Join Date
    Jan 1970
    Location
    UK
    Posts
    23,884

    Default

    You probably don't need PWMOUT. You can hardwire the LED fr the background brightness then just PULSOUT a pin to go low to create a brighter flash -

    Code:
    -.- +V
     |              ___
     `---|>|---.---|___|--------( PICAXE
               |    ___
         LED   `---|___|---.
                          _|_ 0V
    Keep the PICAXE pin as an input normally, PULSOUT then execute another INPUT command.

  6. #6
    Senior Member
    Join Date
    May 2010
    Location
    Newcastle Australia
    Posts
    314

    Default

    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
    second pause.

    I tested the program with a standard LED.

    Code:
    ' 08m2 program for star simulation
    setfreq M4
    pwmout c.2,100,0
    main:
    	do
    		random w0
    		w1 = w0/100 + 100  'Range between  100 to 855 mS 
    		'debug
    		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.  
    		
    	loop

    Bill
    "It always seems imposible until it's done" Nelson Mandela.

  7. #7
    Member
    Join Date
    Mar 2014
    Location
    maryland
    Posts
    64

    Default

    Once again, thank you for your inputs! Her project is underway.....
    Dave

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •