Coding for arduino

Hello guys,
I want a program for arduino nano with a dc motor and a switch. So that when i press the switch the motor will spin for 2s clockwise and stop and when i press the switch again the motor will spin counterclockwise for 2s and stop.
I want the coding for this, so if anyone of u could help me out.

If you just want someone to write a program for you please ask in the Gigs and Collaborations section of the Forum and be prepared to pay.

If you want to learn to program yourself the examples that come with the Arduino IDE are a good place to start. There are also many online tutorials. Also see the Useful Links Thread.

...R

Robin2:
be prepared to pay.

Pffft.... OP check your PMs for complete solution FoC. (At least "complete" as can be, given the sparse information. E&OE, YMMV.)

I think Robin2 was not scratching for cash - but heading toward the Arducation of the OP, which you may have short-circuited.

If the OP is given his solution on a plate - heaven help him when they have to work for a living.
Better they learn to create than to consume.

lastchancename:
the Arducation of the OP

OP gave no indication that he or she wants or needs Arducation. Indeed, s/he indicated quite the opposite:

I want a program...I want the coding for this

I supplied....

I will admit though, that the only reason I posted here that I had PM'd the OP who would presumably see my PM anyway, was to see how many responders got on their high horses about catching a fish vs teaching to fish. There are loads of threads on this forum where it's clear the OP has little or no desire to learn, and just needs some code to get a problem off the todo list.

(And I didn't for a second think that Robin2, arguably the most helpful soul on this site for may years, and one of the few who never belittles the OP or is rude and insulting, was scrabbling for cash.)

coffeeBean:
I will admit though, that the only reason I posted here that I had PM'd the OP who would presumably see my PM anyway, was to see how many responders got on their high horses about catching a fish vs teaching to fish.

Or perhaps about how clever it is to just give people the answers to their homework with no attempt to persuade them that it's a good idea to learn something. Even if they do say they just want an answer.

Steve

the help you'll get here is about as good as it gets - if you try to help youself

coffeeBean:
I will admit though, that the only reason I posted here that I had PM'd the OP who would presumably see my PM anyway, was to see how many responders got on their high horses about catching a fish vs teaching to fish.

Whatever about the fishing arguments, I prefer to give advice in the Public Forum so that everyone can see it and not just the recipient of the PM.

And if I post something in Public that includes an error (which is not unusual) another knowledgeable person has the opportunity to point out the error so that I can correct it.

...R