Run DC motor clockwise, counter clockwise and Stop

Hi.

I was hoping someone can help with some code to control DC motor.

I want the DC motor to run clockwise, counter clockwise and Stop ( using 2 push buttons ).

I am using particle Photon on a phobot shield.

Thank you.

Controlled with the Blynk app.

Thank you.

PhoBot shield code.

How do you plan on wiring the motor up?
I would assume that the motor will draw more current than the output pins can handle.
I suspect you will need to set up a circuit that allows you to reverse the polarity of the current going to the DC motor to get the different directions. You may need to use some MOSFETs to switch an appropriate supply voltage to the motor. Perhaps two MOSFETs to switch the current for one way and two more for the other direction.

Once you know how the motor will be connected you will now what sort of outputs are needed from your device, and making the code set those outputs will be clearer.

This is a dual H-Bridge controller… and having such is an absolute essential as GPIO is signal level ONLY, never for driving any large load, particularly inductive ones that can feedback and kill the GPIO or even the entire MCU.

We generally don’t do your programming for you… there are plenty of tutorial sites and “pay for programming” sites out there.

Besides, there are many topics in this forum already showing various examples of controlling motors. As recommended in the Welcome Topic and throughout this forum, please search first.

I recommend keywords like Robot, Motor, Car, Rover, etc…

Thank you.