Shop OBEX P1 Docs P2 Docs Learn Events
How do I use ..........>>>>>> PWM 0,PWM 2 and PWM 4 at the same time — Parallax Forums

How do I use ..........>>>>>> PWM 0,PWM 2 and PWM 4 at the same time

sam_sam_samsam_sam_sam Posts: 2,286
edited 2008-07-07 18:27 in General Discussion
·Here is what i have so far

I am using these leds and a UNL2803A ·Darlingtion Chip
I am not sure which ones i am using because i bought both

http://www.goldmine-elec-products.com/prodinfo.asp?number=G16706

http://www.goldmine-elec-products.com/prodinfo.asp?number=G16721

I have the fade working good but ....>>>>>· I·would like to fade all three colors at the same time in a routine
I am not sure how to start to write this part can some one help with an example of how to do this



·' {$STAMP BS2}
' {$PBASIC 2.5}



Green_Led··· PIN··· 0
Blue_Led···· PIN··· 2
Red_Led····· PIN··· 4

temp VAR Byte

run:
DO
FOR temp = 30 TO 250 STEP 1
· PWM Green_Led , temp, 20
NEXT
FOR temp = 250 TO 30 STEP 1
· PWM Green_Led , temp, 20
NEXT
FOR temp = 30 TO 250 STEP 1
· PWM Blue_Led· , temp, 20
NEXT
FOR temp = 250 TO 30 STEP 1
· PWM Blue_Led· , temp, 20
NEXT
FOR temp = 30 TO 250 STEP 1
· PWM Red_Led , temp, 20
NEXT
FOR temp = 250 TO 30 STEP 1
· PWM Red_Led , temp, 20
NEXT
PAUSE 1
LOOP


'

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Post Edited (sam_sam_sam) : 7/5/2008 2:04:30 AM GMT

Comments

  • FranklinFranklin Posts: 4,747
    edited 2008-07-05 03:59
    FOR temp = 250 TO 30 STEP 1
    PWM Red_Led , temp, 20
    PWM Blue_Led , temp, 20
    PWM Green_Led , temp, 20
    NEXT

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2008-07-06 21:56
    Franklin

    Thank for your reply and help

    I will give this a try··· smile.gif


    Update



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 7/7/2008 6:26:00 PM GMT
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2008-07-07 18:27
    Green_Led··· PIN··· 0
    Blue_Led···· PIN··· 2
    Red_Led····· PIN··· 4

    temp········ VAR··· Byte
    laps········ VAR··· Byte
    run:

    I got it to work Thank You for your help

    I would like to know how to hold a level for 5 seconds or more

    ·If I use PAUSE command it shuts the LEDs off for the pause TIME·then·Lights ·them up again then fades

    I would like·to be·smooth......>>>>>> ·NO LEDs..>> Fade to·full LEDs lights·ON.....then..... Fade to full LEDs OFF

    DO
    FOR temp = 30 TO 250 STEP 1
    · PWM Green_Led , temp, 05
    · PWM Blue_Led· , temp, 05
    · PWM Red_Led· , temp, 05
    NEXT

    ·temp = 255
    · PWM Green_Led , temp, 05·······' How can·I hold this level for 5 seconds or more
    · PWM Blue_Led· , temp, 05
    · PWM Red_Led· , temp, 05


    FOR temp = 250 TO 30 STEP 1
    · PWM Red_Led· , temp, 05
    · PWM Blue_Led· , temp, 05
    · PWM Green_Led·· , temp, 05
    · NEXT
    · PAUSE 1
    LOOP


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 7/7/2008 6:40:04 PM GMT
Sign In or Register to comment.