Single Button Swtiching LED

Hi,

I need help in writing this C Program

Circuit : LED are connected to P1.0 to P1.4 , a push button (push to on) Switch is connected to P1.7
When button is pressed first time, LED on P1.0 switches on, when switch is pressed again, LED on P1.0 switches off and then LED on P1.1 glows, same cycle repeats (P1.2, P1.3, P1.4 then again P1.0) whenever push button is pressed.

Thanks
suds
sudhirmt@gmail.com

Parents
  • Thanks

    Best part is I have finished with switch de-bounce code. working fine.. I have completed push button, on off code also.

    now .. breaking my head on finding out how to switch on pins one after another
    Here is the flow..

    (Start) -> [p1 =0 ] -> <if p1.0 - p1.4 is 0, then p1.1 if 1] -> <if p1.0 ||p1.1||p1.2||p1.3||p1.4 = 1 > !! ?? !!

    Not understanding how to keep track which pin is 1 , and how to make that pin 0, then next pin 1 on key press.

    can some one show me relevant code, some example code.. which will help me in understanding .. so I can write further code myself.

Reply
  • Thanks

    Best part is I have finished with switch de-bounce code. working fine.. I have completed push button, on off code also.

    now .. breaking my head on finding out how to switch on pins one after another
    Here is the flow..

    (Start) -> [p1 =0 ] -> <if p1.0 - p1.4 is 0, then p1.1 if 1] -> <if p1.0 ||p1.1||p1.2||p1.3||p1.4 = 1 > !! ?? !!

    Not understanding how to keep track which pin is 1 , and how to make that pin 0, then next pin 1 on key press.

    can some one show me relevant code, some example code.. which will help me in understanding .. so I can write further code myself.

Children
More questions in this forum