Shop OBEX P1 Docs P2 Docs Learn Events
Lighthouse? — Parallax Forums

Lighthouse?

tweektweek Posts: 14
edited 2007-11-02 04:04 in BASIC Stamp
Im new to Basic Stamps. I recently bought a homework board and have been having fun with it,(led's and such). I recently built a "lighthouse circuit", (ALL info obtained from discoverycircuits,David Johnson) http://www.discovercircuits.com/DJ-Circuits/lighthouseflash5.htm
It slowly ramps up the current to an LED, then flashes it bright, then dims again, like a rotating lighthouse. ,but,
I was wondering if it would be possible to do this same thing on the Homework board? All I really figured out so far on/off and pause durations, and freqouts, to make them flash a bit.
Thanks

Comments

  • metron9metron9 Posts: 1,100
    edited 2007-11-02 04:04
    Connect LED to pin 15 and a 220 ohm resistor from led to ground. This should simulate what you are looking for i think.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    ' {$PORT COM1}
    i VAR Word
    j VAR Byte
    k VAR Byte
    main:
    j=0
    k=1
    FOR i=1 TO 3000 'fade up slow from dim
     PULSOUT 15,k
     j=j+1
     IF j=15 THEN
      j=0
      k=k+1
     ENDIF
    NEXT
    FOR i=k TO 300  'fade up fast
     PULSOUT 15,i
    NEXT
    FOR i=300 TO k  'fade down fast
     PULSOUT 15,i
    NEXT
    j=0
    FOR i=3000 TO 1 'fade back to dim slow
     PULSOUT 15,k
     j=j+1
     IF j=15 THEN
      j=0
      k=k-1
     ENDIF
    NEXT
    GOTO main
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Think Inside the box first and if that doesn't work..
    Re-arrange what's inside the box then...
    Think outside the BOX!
Sign In or Register to comment.