Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
We write a FAQ for newcomers, and especially for students.
So what happens here?
- You are asking for code.
Usually you don't ask for code. You first write some code and if it doesn't work you post it
and ask for advice. Asking for code, everybody will think you're just a lazy chap who wants
his homework made by others.
- This time, you were lucky, somebody gives you a fully working code.
When you get a working code, a good thing is to first try to make it work, then figure out
how to adapt it to your homework, and then, back to first point, ask for advice if what you wrote
At this point, I should add: use a versioning system. For example tortoise git or tortoise svn or
something else. Then if you start from a working program, modify a few lines, in case it doesn't
work anymore, you can easily come back to the last working version.
- Last comment:
Apparently the code you got is EXACTLY what you want. The only difference is that the button
works in the opposite polarity. So here is my advice: if you really cannot solve this problem,
you may consider to change your field of study for something else. Why not cooking? Cooking
would be perfect because you do exactly as written on the recipe.