Shop OBEX P1 Docs P2 Docs Learn Events
Program Help — Parallax Forums

Program Help

rrrr Posts: 63
edited 2008-04-30 17:39 in BASIC Stamp
Hello,
·
I·am using a potentiometer and a pwm co-processor to control the·output of some red, green, and blue leds. Using the output from the r/c time command I am selecting different colors to send to the pwm coprocessor. Right now everything works pretty well, but I know my program could be improved. Any ideas on how to output some usable numbers instead of selecting the color from a list? Theoretically, I can display millions of colors but my current program can only display 47.
·
Any help would be appreciated...
rr

Comments

  • AmaralAmaral Posts: 176
    edited 2008-04-30 17:39
    As I see, your pwm co-processor receives the intensity of each output as a number from 0 to 255 right ?

    so you can have 3 var, one for each color,

    for a simple test , try:

    g=80
    b=120

    DO
    FOR r=0 to 255
    RANDOM g
    RANDOM b

    SEROUT 7, baud, [noparse][[/noparse]$2F, b]
    SEROUT 7, baud, [noparse][[/noparse]$2D, g]
    SEROUT 7, baud, [noparse][[/noparse]$2B, r]
    PAUSE 1
    NEXT
    LOOP

    just to see if you have a bunch of colors flashing without control !


    Amaral
Sign In or Register to comment.