Shop OBEX P1 Docs P2 Docs Learn Events
PWM-Vs-VoltageFollower-Vs-DigitalPot — Parallax Forums

PWM-Vs-VoltageFollower-Vs-DigitalPot

ArchiverArchiver Posts: 46,084
edited 2004-02-28 04:43 in General Discussion
I need a variable voltage output from a BS2 to controll an LED's brightness. As
I understand it, PWM, Voltage Follower circuitry, or a Digital pot could be used
with a BS2 to electronically control the LED intensity. Which is best. How do
I choose.


Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.

[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-02-19 11:22
    You may go in and check the documentation at Parallax. The have a
    project with an OP-amp and code for you.

    Lars

    --- In basicstamps@yahoogroups.com, Jimmy jones <cantyant@y...>
    wrote:
    > I need a variable voltage output from a BS2 to controll an LED's
    brightness. As I understand it, PWM, Voltage Follower circuitry, or
    a Digital pot could be used with a BS2 to electronically control the
    LED intensity. Which is best. How do I choose.
    >
    >
    >
    > Do you Yahoo!?
    > Yahoo! Mail SpamGuard - Read only the mail you want.
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-19 17:28
    An LED is really a current device.
    It drops 2.1 Volts across itself for a
    large range of currents -- and light output
    is more proportional to current than applied
    voltage.

    Having said that, the usual way to control
    an LED's brightness is by varying the on
    and off times using PWM. If you cycle faster
    than 100 times a second the human eye averages
    the 'fast blinks' together into a glow.

    Unfortunately, the Stamp does not have a hardware
    PWM, and you don't really want to dedicate a
    Stamp to making a few LED's glow. So, for stamp
    use changing the output voltage of a circuit
    -- which gets converted to a variable
    current through the LED -- is the most
    do-able approach.

    See the reference mentioned in an earlier post.



    --- In basicstamps@yahoogroups.com, Jimmy jones <cantyant@y...> wrote:
    > I need a variable voltage output from a BS2 to controll an LED's
    brightness. As I understand it, PWM, Voltage Follower circuitry, or
    a Digital pot could be used with a BS2 to electronically control the
    LED intensity. Which is best. How do I choose.
    >
    >
    >
    > Do you Yahoo!?
    > Yahoo! Mail SpamGuard - Read only the mail you want.
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-19 18:21
    thanks for the response,

    now Which option is best. How do I choose. Where do I find that info at
    parallax, i have several of there manuals and text.


    lars505050 <ls@l...> wrote:
    You may go in and check the documentation at Parallax. The have a
    project with an OP-amp and code for you.

    Lars

    --- In basicstamps@yahoogroups.com, Jimmy jones
    wrote:
    > I need a variable voltage output from a BS2 to controll an LED's
    brightness. As I understand it, PWM, Voltage Follower circuitry, or
    a Digital pot could be used with a BS2 to electronically control the
    LED intensity. Which is best. How do I choose.
    >
    >
    >
    > Do you Yahoo!?
    > Yahoo! Mail SpamGuard - Read only the mail you want.
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]



    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and Body of
    the message will be ignored.

    Yahoo! Groups Links




    kd

    Do you Yahoo!?
    Yahoo! Mail SpamGuard - Read only the mail you want.

    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-19 18:40
    Try exp #22 in Stamp Works

    Lars
    --- In basicstamps@yahoogroups.com, Jimmy jones <cantyant@y...>
    wrote:
    > thanks for the response,
    >
    > now Which option is best. How do I choose. Where do I find that
    info at parallax, i have several of there manuals and text.
    >
    >
    > lars505050 <ls@l...> wrote:
    > You may go in and check the documentation at Parallax. The have a
    > project with an OP-amp and code for you.
    >
    > Lars
    >
    > --- In basicstamps@yahoogroups.com, Jimmy jones
    > wrote:
    > > I need a variable voltage output from a BS2 to controll an LED's
    > brightness. As I understand it, PWM, Voltage Follower circuitry,
    or
    > a Digital pot could be used with a BS2 to electronically control
    the
    > LED intensity. Which is best. How do I choose.
    > >
    > >
    > >
    > > Do you Yahoo!?
    > > Yahoo! Mail SpamGuard - Read only the mail you want.
    > >
    > > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    Subject and Body of the message will be ignored.
    >
    > Yahoo! Groups Links
    >
    >
    >
    >
    > kd
    >
    >
    > Do you Yahoo!?
    > Yahoo! Mail SpamGuard - Read only the mail you want.
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-19 20:46
    Jimmy,

    I built a heart with an arrow through it that consisted of 64 LEDs for my
    daughter to use on a Valentine box. I used 8 TI TPIC2810 LED Drivers. I
    wrote a routine to create a software PWM to control how long the Enable of
    the TPIC2810 was active during a 15 msec period. I was able to vary the
    intensity from full on to off. I would be willing to provide you with my
    routines if you are interested.

    Ron


    |
    +
    >
    | | Jimmy jones |
    | | <cantyant@y...|
    | | om> |
    | | No Phone Info |
    | | Available |
    | | |
    | | 02/18/2004 11:38 |
    | | PM |
    | | Please respond to|
    | | basicstamps |
    | | |
    |
    +
    >

    >
    \
    |
    |
    |
    | To: basicstamps@yahoogroups.com
    |
    | cc:
    |
    | Subject: [noparse][[/noparse]basicstamps] PWM-Vs-VoltageFollower-Vs-DigitalPot
    |

    >
    \
    |




    I need a variable voltage output from a BS2 to controll an LED's
    brightness. As I understand it, PWM, Voltage Follower circuitry, or a
    Digital pot could be used with a BS2 to electronically control the LED
    intensity. Which is best. How do I choose.


    Do you Yahoo!?
    Yahoo! Mail SpamGuard - Read only the mail you want.

    [noparse][[/noparse]Non-text portions of this message have been removed]



    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.

    Yahoo! Groups Links
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-19 21:12
    yes please! thank you!!


    - ron.metzner@s... wrote:
    >
    > Jimmy,
    >
    > I built a heart with an arrow through it that
    > consisted of 64 LEDs for my
    > daughter to use on a Valentine box. I used 8 TI
    > TPIC2810 LED Drivers. I
    > wrote a routine to create a software PWM to control
    > how long the Enable of
    > the TPIC2810 was active during a 15 msec period. I
    > was able to vary the
    > intensity from full on to off. I would be willing
    > to provide you with my
    > routines if you are interested.
    >
    > Ron
    >
    >
    > |
    +
    >
    > | | Jimmy jones |
    > | | <cantyant@y...|
    > | | om> |
    > | | No Phone Info |
    > | | Available |
    > | | |
    > | | 02/18/2004 11:38 |
    > | | PM |
    > | | Please respond to|
    > | | basicstamps |
    > | | |
    > |
    +
    >
    >
    >
    >
    \
    |
    > |
    >
    > |
    > | To: basicstamps@yahoogroups.com
    >
    > |
    > | cc:
    >
    > |
    > | Subject: [noparse][[/noparse]basicstamps]
    > PWM-Vs-VoltageFollower-Vs-DigitalPot
    > |
    >
    >
    >
    \
    |
    >
    >
    >
    >
    > I need a variable voltage output from a BS2 to
    > controll an LED's
    > brightness. As I understand it, PWM, Voltage
    > Follower circuitry, or a
    > Digital pot could be used with a BS2 to
    > electronically control the LED
    > intensity. Which is best. How do I choose.
    >
    >
    >
    > Do you Yahoo!?
    > Yahoo! Mail SpamGuard - Read only the mail you want.
    >
    > [noparse][[/noparse]Non-text portions of this message have been
    > removed]
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed.
    > Text in the Subject and
    > Body of the message will be ignored.
    >
    > Yahoo! Groups Links
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed.
    > Text in the Subject and Body of the message will be
    > ignored.
    >
    > Yahoo! Groups Links
    >
    >
    > basicstamps-unsubscribe@yahoogroups.com
    >
    >
    >


    __________________________________
    Do you Yahoo!?
    Yahoo! Mail SpamGuard - Read only the mail you want.
    http://antispam.yahoo.com/tools
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-19 21:45
    Okay, everybody now, 1.. 2.. 3..

    Awww, that's Cute!


    --- In basicstamps@yahoogroups.com, ron.metzner@s... wrote:
    >
    > Jimmy,
    >
    > I built a heart with an arrow through it that consisted of 64 LEDs
    for my
    > daughter to use on a Valentine box. I used 8 TI TPIC2810 LED
    Drivers. I
    > wrote a routine to create a software PWM to control how long the
    Enable of
    > the TPIC2810 was active during a 15 msec period. I was able to
    vary the
    > intensity from full on to off. I would be willing to provide you
    with my
    > routines if you are interested.
    >
    > Ron
    >
    >
    > |
    +
    >
    > | | Jimmy jones |
    > | | <cantyant@y...|
    > | | om> |
    > | | No Phone Info |
    > | | Available |
    > | | |
    > | | 02/18/2004 11:38 |
    > | | PM |
    > | | Please respond to|
    > | | basicstamps |
    > | | |
    > |
    +
    >
    > >

    |
    >
    |
    |
    > | To:
    basicstamps@yahoogroups.com
    |
    > |
    cc:
    |
    > | Subject: [noparse][[/noparse]basicstamps] PWM-Vs-VoltageFollower-Vs-
    DigitalPot
    |
    > >

    |
    >
    >
    >
    >
    > I need a variable voltage output from a BS2 to controll an LED's
    > brightness. As I understand it, PWM, Voltage Follower circuitry,
    or a
    > Digital pot could be used with a BS2 to electronically control the
    LED
    > intensity. Which is best. How do I choose.
    >
    >
    >
    > Do you Yahoo!?
    > Yahoo! Mail SpamGuard - Read only the mail you want.
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    Subject and
    > Body of the message will be ignored.
    >
    > Yahoo! Groups Links
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-22 01:44
    --- ron.metzner@s... wrote:
    >
    > Jimmy,
    > I built a heart with an arrow through it that
    > consisted of 64 LEDs for my
    > daughter to use on a Valentine box. I used 8 TI
    > TPIC2810 LED Drivers. I
    > wrote a routine to create a software PWM to control
    > how long the Enable of
    > the TPIC2810 was active during a 15 msec period. I
    > was able to vary the
    > intensity from full on to off. I would be willing
    > to provide you with my
    > routines if you are interested.

    Ron,

    I would be interested in your routines, if you are
    willing to share them. Thanks.



    =====
    Chris Savage
    Knight Designs
    324 West Main Street
    Montour Falls, NY 14865
    (607) 535-6777

    http://www.knightdesigns.com

    __________________________________
    Do you Yahoo!?
    Yahoo! Mail SpamGuard - Read only the mail you want.
    http://antispam.yahoo.com/tools
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-22 21:14
    Hi,

    Do you know of any lab out there (or at parallax) that uses an adc to convert an
    analog input to digital, to connect to a BS2, and then sends out a variable
    output on another pin. The labs we spoke of are simply for the variable output
    and display in a debug window. I dont need the debug window display and what I
    do need is an adc input program along with the output program (and possably a
    wiring descripition)?

    Allan Lane <allan.lane@h...> wrote:
    Okay, everybody now, 1.. 2.. 3..

    Awww, that's Cute!


    --- In basicstamps@yahoogroups.com, ron.metzner@s... wrote:
    >
    > Jimmy,
    >
    > I built a heart with an arrow through it that consisted of 64 LEDs
    for my
    > daughter to use on a Valentine box. I used 8 TI TPIC2810 LED
    Drivers. I
    > wrote a routine to create a software PWM to control how long the
    Enable of
    > the TPIC2810 was active during a 15 msec period. I was able to
    vary the
    > intensity from full on to off. I would be willing to provide you
    with my
    > routines if you are interested.
    >
    > Ron
    >
    >
    > |
    +
    >
    > | | Jimmy jones |
    > | | > | | om> |
    > | | No Phone Info |
    > | | Available |
    > | | |
    > | | 02/18/2004 11:38 |
    > | | PM |
    > | | Please respond to|
    > | | basicstamps |
    > | | |
    > |
    +
    >
    > >

    |
    >
    |
    |
    > | To:
    basicstamps@yahoogroups.com
    |
    > |
    cc:
    |
    > | Subject: [noparse][[/noparse]basicstamps] PWM-Vs-VoltageFollower-Vs-
    DigitalPot
    |
    > >

    |
    >
    >
    >
    >
    > I need a variable voltage output from a BS2 to controll an LED's
    > brightness. As I understand it, PWM, Voltage Follower circuitry,
    or a
    > Digital pot could be used with a BS2 to electronically control the
    LED
    > intensity. Which is best. How do I choose.
    >
    >
    >
    > Do you Yahoo!?
    > Yahoo! Mail SpamGuard - Read only the mail you want.
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the
    Subject and
    > Body of the message will be ignored.
    >
    > Yahoo! Groups Links



    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and Body of
    the message will be ignored.

    Yahoo! Groups Links








    Do you Yahoo!?
    Yahoo! Mail SpamGuard - Read only the mail you want.

    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-25 19:24
    Hi,

    Do you know of any lab out there (or at parallax) that uses an adc to convert an
    analog input to digital, to connect to a BS2, and then sends out a variable
    output on another pin. The labs we spoke of are simply for the variable output
    and display in a debug window. I dont need the debug window display and what I
    do need is an adc input program along with the output program (and possably a
    wiring descripition)?

    or how would I combine one program for an ADC with a program for a variable
    output

    Allan Lane <allan.lane@h...> wrote:
    Okay, everybody now, 1.. 2.. 3..

    Awww, that's Cute!


    --- In basicstamps@yahoogroups.com, ron.metzner@s... wrote:
    >
    > Jimmy,
    >
    > I built a heart with an arrow through it that consisted of 64 LEDs
    for my
    > daughter to use on a Valentine box. I used 8 TI TPIC2810 LED
    Drivers. I
    > wrote a routine to create a software PWM to control how long the
    Enable of
    > the TPIC2810 was active during a 15 msec period. I was able to
    vary the
    > intensity from full on to off. I would be willing to provide you
    with my
    > routines if you are interested.
    >
    > Ron
    >
    >
    > |
    +
    >
    > | | Jimmy jones |
    > | | > | | om> |
    > | | No Phone Info |
    > | | Available |
    > | | |
    > | | 02/18/2004 11:38 |
    > | | PM |
    > | | Please respond to|
    > | | basicstamps |
    > | | |
    > |
    +
    >
    > >

    |
    >
    |
    |
    > | To:
    basicstamps@yahoogroups.com
    |
    > |
    cc:
    |
    > | Subject: [noparse][[/noparse]basicstamps] PWM-Vs-VoltageFollower-Vs-
    DigitalPot
    |
    > >

    |
    >
    >
    >
    >
    > I need a variable voltage output from a BS2 to controll an LED's
    > brightness. As I understand it, PWM, Voltage Follower circuitry,
    or a
    > Digital pot could be used with a BS2 to electronically control the
    LED
    > intensity. Which is best. How do I choose.





    Do you Yahoo!?
    Yahoo! Mail SpamGuard - Read only the mail you want.

    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-25 19:34
    hello,

    that would be great. How do I apply it to a single LED and only use the
    bright/dim routine?

    ron.metzner@s... wrote:

    Jimmy,

    I built a heart with an arrow through it that consisted of 64 LEDs for my
    daughter to use on a Valentine box. I used 8 TI TPIC2810 LED Drivers. I
    wrote a routine to create a software PWM to control how long the Enable of
    the TPIC2810 was active during a 15 msec period. I was able to vary the
    intensity from full on to off. I would be willing to provide you with my
    routines if you are interested.

    Ron


    |
    +
    >
    | | Jimmy jones |
    | | | | om> |
    | | No Phone Info |
    | | Available |
    | | |
    | | 02/18/2004 11:38 |
    | | PM |
    | | Please respond to|
    | | basicstamps |
    | | |
    |
    +
    >
    >
    \
    |
    | |
    | To: basicstamps@yahoogroups.com |
    | cc: |
    | Subject: [noparse][[/noparse]basicstamps] PWM-Vs-VoltageFollower-Vs-DigitalPot |
    >
    \
    |




    I need a variable voltage output from a BS2 to controll an LED's
    brightness. As I understand it, PWM, Voltage Follower circuitry, or a
    Digital pot could be used with a BS2 to electronically control the LED
    intensity. Which is best. How do I choose.


    Do you Yahoo!?
    Yahoo! Mail SpamGuard - Read only the mail you want.

    [noparse][[/noparse]Non-text portions of this message have been removed]



    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.

    Yahoo! Groups Links












    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and Body of
    the message will be ignored.

    Yahoo! Groups Links






    Do you Yahoo!?
    Yahoo! Mail SpamGuard - Read only the mail you want.


    Do you Yahoo!?
    Yahoo! Mail SpamGuard - Read only the mail you want.


    Do you Yahoo!?
    Yahoo! Mail SpamGuard - Read only the mail you want.

    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-25 19:49
    To save me from sifting through all the basicstamps@yahoogroups.com
    email, please reply to me(Jimmy jomes or cantyant@y...) AT
    gooey_lou@y...


    Jimmy jones <cantyant@y...> wrote:

    hello,

    that would be great. How do I apply it to a single LED and only use the
    bright/dim routine?

    ron.metzner@s... wrote:

    Jimmy,

    I built a heart with an arrow through it that consisted of 64 LEDs for my
    daughter to use on a Valentine box. I used 8 TI TPIC2810 LED Drivers. I
    wrote a routine to create a software PWM to control how long the Enable of
    the TPIC2810 was active during a 15 msec period. I was able to vary the
    intensity from full on to off. I would be willing to provide you with my
    routines if you are interested.

    Ron


    |
    +
    >
    | | Jimmy jones |
    | | | | om> |
    | | No Phone Info |
    | | Available |
    | | |
    | | 02/18/2004 11:38 |
    | | PM |
    | | Please respond to|
    | | basicstamps |
    | | |
    |
    +
    >
    >
    \
    |
    | |
    | To: basicstamps@yahoogroups.com |
    | cc: |
    | Subject: [noparse][[/noparse]basicstamps] PWM-Vs-VoltageFollower-Vs-DigitalPot |
    >
    \
    |




    I need a variable voltage output from a BS2 to controll an LED's
    brightness. As I understand it, PWM, Voltage Follower circuitry, or a
    Digital pot could be used with a BS2 to electronically control the LED
    intensity. Which is best. How do I choose.


    Do you Yahoo!?
    Yahoo! Mail SpamGuard - Read only the mail you want.

    [noparse][[/noparse]Non-text portions of this message have been removed]



    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.

    Yahoo! Groups Links












    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and Body of
    the message will be ignored.

    Yahoo! Groups Links






    Do you Yahoo!?
    Yahoo! Mail SpamGuard - Read only the mail you want.


    Do you Yahoo!?
    Yahoo! Mail SpamGuard - Read only the mail you want.


    Do you Yahoo!?
    Yahoo! Mail SpamGuard - Read only the mail you want.

    [noparse][[/noparse]Non-text portions of this message have been removed]




    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and Body of
    the message will be ignored.

    Yahoo! Groups Links




    Do you Yahoo!?
    Yahoo! Mail SpamGuard - Read only the mail you want.

    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-26 05:30
    thanks,

    let me give it a try.

    Ron.Metzner@s... wrote:

    Jimmy,

    I am sorry for not getting back earlier. This routine will work for a
    single LED. This routine assumes the LED is turned on by taking one of the
    I/O lines low. In my case I had it set to 2. You can adjust 'FadePrd' to
    eliminate blinking. This is like a software PWM where FadePrd determines
    the cycle period and TimeOn is used to keep track of how long to keep the
    LED on in the cycle period. This program will continuously
    increase/decrease the brightness of an LED. I was going to try this before
    I sent it to you since I modified this code to run on one LED and not 64
    but did not get around to it. I took out all the code that utilized the 8
    LED drivers. Let me know if it does not work. I will also try it out
    tonight.

    '{$STAMP BS2p} 'STAMP directive (specifies a BS2p)

    FadeCyc CON 5 'Number of times to spend at each fade
    level
    LEDen CON 2 'Set which I/O pin controls enabling LED
    driver. LEDen is active low.
    FadePrd CON 15 'Cycle time (period) to toggle LED

    Fades VAR NIB 'Var to count how many times to delay going
    to next fade level
    HowMany VAR BYTE 'How Many times to loop through the feature
    TimeOn VAR BYTE 'Time delay to keep LED on

    Start:
    HIGH LEDen 'Turn off LED

    'This part of the routine increases the intensity of the LED from off to on

    FOR TimeOn = 1 to FadePrd 'Set time LED is on from 1 to 15 ms
    FOR Fades = 1 to FadeCyc 'Stay at this fade level for the number of
    times specified in FadeCyc
    LOW LEDen 'Turn on LED
    PAUSE TimeOn 'Delay time specified in TimeOn before
    turning off LED
    HIGH LEDen 'Turn off LED
    PAUSE (FadePrd - TimeOn) 'Keep LED off for remaining time left in
    fade cycle
    NEXT
    NEXT

    'This part of the routine decreases the intensity of the LED from on to off

    FOR TimeOn = 1 to FadePrd 'Set time LED is turned off in the cycle
    from 1 to 15 ms
    FOR Fades = 1 to FadeCyc 'Stay at this fade level for the number of
    times specified in FadeCyc
    LOW LEDen 'Turn on LED
    PAUSE (FadePrd - TimeOn) 'Delay time specified in FadePrd - TimeOn
    before turning LED off
    HIGH LEDen 'Turn off LED
    PAUSE TimeOn 'Keep LED off for remaining time left in
    fade cycle
    NEXT
    NEXT
    GOTO Start


    Thanks.

    Ron




    Do you Yahoo!?
    Get better spam protection with Yahoo! Mail

    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2004-02-28 04:43
    how would I wire this project?



    gooey <cantyant@y...> wrote:thanks,

    let me give it a try.

    Ron.Metzner@s... wrote:

    Jimmy,

    I am sorry for not getting back earlier. This routine will work for a
    single LED. This routine assumes the LED is turned on by taking one of the
    I/O lines low. In my case I had it set to 2. You can adjust 'FadePrd' to
    eliminate blinking. This is like a software PWM where FadePrd determines
    the cycle period and TimeOn is used to keep track of how long to keep the
    LED on in the cycle period. This program will continuously
    increase/decrease the brightness of an LED. I was going to try this before
    I sent it to you since I modified this code to run on one LED and not 64
    but did not get around to it. I took out all the code that utilized the 8
    LED drivers. Let me know if it does not work. I will also try it out
    tonight.

    '{$STAMP BS2p} 'STAMP directive (specifies a BS2p)

    FadeCyc CON 5 'Number of times to spend at each fade
    level
    LEDen CON 2 'Set which I/O pin controls enabling LED
    driver. LEDen is active low.
    FadePrd CON 15 'Cycle time (period) to toggle LED

    Fades VAR NIB 'Var to count how many times to delay going
    to next fade level
    HowMany VAR BYTE 'How Many times to loop through the feature
    TimeOn VAR BYTE 'Time delay to keep LED on

    Start:
    HIGH LEDen 'Turn off LED

    'This part of the routine increases the intensity of the LED from off to on

    FOR TimeOn = 1 to FadePrd 'Set time LED is on from 1 to 15 ms
    FOR Fades = 1 to FadeCyc 'Stay at this fade level for the number of
    times specified in FadeCyc
    LOW LEDen 'Turn on LED
    PAUSE TimeOn 'Delay time specified in TimeOn before
    turning off LED
    HIGH LEDen 'Turn off LED
    PAUSE (FadePrd - TimeOn) 'Keep LED off for remaining time left in
    fade cycle
    NEXT
    NEXT

    'This part of the routine decreases the intensity of the LED from on to off

    FOR TimeOn = 1 to FadePrd 'Set time LED is turned off in the cycle
    from 1 to 15 ms
    FOR Fades = 1 to FadeCyc 'Stay at this fade level for the number of
    times specified in FadeCyc
    LOW LEDen 'Turn on LED
    PAUSE (FadePrd - TimeOn) 'Delay time specified in FadePrd - TimeOn
    before turning LED off
    HIGH LEDen 'Turn off LED
    PAUSE TimeOn 'Keep LED off for remaining time left in
    fade cycle
    NEXT
    NEXT
    GOTO Start


    Thanks.

    Ron




    Do you Yahoo!?
    Get better spam protection with Yahoo! Mail

    [noparse][[/noparse]Non-text portions of this message have been removed]




    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and Body of
    the message will be ignored.

    Yahoo! Groups Links





    Do you Yahoo!?
    Get better spam protection with Yahoo! Mail

    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.