I am working on a DC motor control application, I need to start motor clock wise on pressing a button which send '3' to arduino and if I again the same button then motor should rotate anti clock wise. But when i run the following code and press button only one time then motor rotates clock and anti clock wise infinity. please help.
arduino code is as follow
thanks for your fast reply, actually I am new to Arduino prog. and don't know expert programming, can you please help in writing a sample code. please.......
Hi friends,
working on an interesting project of switching and operating DC motors through my android device using bluetooth.
In my android application there are two buttons which sends '3' and '4' respectively as follows
Button1 >>> sends '3' on every press to arduino
Button2 >>> sends '4' on every press to arduino
I have written and tested a code only for single button as follow to control a single DC motor to rotate clock wise and anti clock wise on pressing Button1 again and again i.e. on first press motor rotates clock wise and on second press motor should rotate anti clock wise.
here problem is on a single press of Button1 DC motor start rotating clock and anti clock wise infinitely.
ok.... sure I will try. my arduino board is fitted in a box hard to eject and takes time thats why I was seeking others also so that problem could be rectify in a single board ejection....... but if you are sure then I will definitely try it.
thanks AWOL
I said you can fix your current problem with a single pair of braces, but you had to repost the same question (again badly) in a new thread, which I then had to merge with this thread to save other people wasting their time answering a question that already had a solution, thereby wasting my time.