Arduino Tutorial 40: Controlling DC Motor Speed and Direction with Pushbuttons

In this lesson we explore how to control the speed and direction of a DC motor using two buttons. We are using the L293D motor controller and a small DC motor for demonstration purposes. We are using parts from our Elegoo Super Stater Kit, which you can get HERE. The basic circuit was explained in Lesson 37, and we are using that work as a starting point. The schematic below will get you started in connecting your circuit. Be sure and connect one of the Arduino ground pins to the ground rail in the second to the bottom row in the diagram below. It is good practice to connect all your grounds together.

DC Motor Controller
Connection Diagram for a DC Motor Controller using the L293 Control Chip

The code we developed in the video lesson is shown below for your convenience.