This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

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
  • The biggest part of the code may be the debounce of the switch. The business logic that is making the decisions is just a very few lines of code. Managing to use ten times as many lines as needed, the business logic would still be quite small, since the original problem is so very simple.

    The project you have in front of you is not even near a real commercial project. It is comparable to a tiny paragraph hidden in a footnote somewhere in the specification of a real product. It is a very simple project intended to be reasonably easy for beginners.

    But it is vital that you solve it yourself, because the future tasks will be continuously harder and if you do not keep up, you will not even be able to understand the specifications of the following tasks. And if you let it slide until you can't understand the requirements specification, you will not even be able to get someone else to write the solution for you.

Reply
  • The biggest part of the code may be the debounce of the switch. The business logic that is making the decisions is just a very few lines of code. Managing to use ten times as many lines as needed, the business logic would still be quite small, since the original problem is so very simple.

    The project you have in front of you is not even near a real commercial project. It is comparable to a tiny paragraph hidden in a footnote somewhere in the specification of a real product. It is a very simple project intended to be reasonably easy for beginners.

    But it is vital that you solve it yourself, because the future tasks will be continuously harder and if you do not keep up, you will not even be able to understand the specifications of the following tasks. And if you let it slide until you can't understand the requirements specification, you will not even be able to get someone else to write the solution for you.

Children
No data