So, the drill is simple enough:
-
Edit your post to display your code in code tags as instructed here in Item # 7 here:
http://forum.arduino.cc/index.php/topic,148850.0.html -
Explain what your code is supposed to do (you’ve done that).
-
Explain what your code actually does and how it is different than what you want.
-
People on the forum will make suggestions about how to fix / improve your code.
-
You change your code per the suggestions and try it out.
-
If the code’s behavior matches your expectations, you’re done.
-
If the code’s behavior doesn’t match your expectations, go back to Step #3.