Shop OBEX P1 Docs P2 Docs Learn Events
pulse width modulation help — Parallax Forums

pulse width modulation help

jive turkeyjive turkey Posts: 2
edited 2007-10-15 18:44 in BASIC Stamp
i need help with pulse width modulation

i am a beginner at programming and i have a light display wich my teacher believes some outputs turn on too quickly so he told me about pulse width modulation which would turn the led on slowly

what i would like is·the easiest subroutine possible becasue right now my program says

··HIGH· sparks
· PAUSE 1500


but he would like the led to turn on a lot slower, i havnt gotten far enough to figure out how to do that so if anybody could help it would be greatly appreciated

Comments

  • D FaustD Faust Posts: 608
    edited 2007-10-15 18:44
    Try the PWM command.

    For brightness = 0 to 255
    PWM sparks, brightness, 16{an arbitrary # to be the duration of the pulse}
    Next
    High sparks
    pause 1500

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    LOOKDOWN ThisThread, [noparse][[/noparse]Your_?, My_?, Cool_Thing], looknum
    LOOKUP looknum, [noparse][[/noparse]1, 2, 3], subnum
    ON subnum GOTO Hope_this_helps, Thanks!, WOW!!
    END 
    
Sign In or Register to comment.