Newbie help. RGB Led on a PIC10F202


Results 1 to 40 of 42

Threaded View

  1. #23
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default Re: Newbie help. RGB Led on a PIC10F202

    Your LEDs are conected to Vdd instead of GND.
    And GPIO is set to 0, so initially all pins are low at the beginning and thus LEDs are on.
    When a PWM cycle is done, the pin stays low again and the LED is still on.

    I am guessing Steve forgat to add these in his last posted code above.


    Before "pwm ButtonCount,127,100", insert these:
    Code:
    HIGH RED
    HIGH GREEN
    HIGH BLUE

    So the new code will be as below:
    Code:
    MAIN:
     
            IF !SwitchPin THEN                              ' Switch down?
     
                                                            ' - YES
     
                    If ButtonCount = 3 THEN ButtonCount = 0 ' - Currently on GP3 (MCLR)?  If so, pass go, claim 200$ 
     
                    HIGH RED
     
                    HIGH GREEN
     
                    HIGH BLUE       
                    pwm ButtonCount,127,100                 ' - Light Show
     
                    WHILE !SwitchPin : wend                 ' - Spin 'till button is released
     
                    pAUSE 50                                ' - arbitrary debouince delay
     
                    ButtonCount = ButtonCount + 1           ' - Point to next LED
     
                    endif                                   ' 
            GOTO MAIN
    Last edited by sayzer; - 14th August 2011 at 21:05. Reason: typo
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts