# data[].attributes.body
Physics Programmer and Robotics Instructor: Brice Criswell

Professional Ballet Dancer and Yoga Instructor: Catherine Hader

Professor of Functional Anatomy: Dr. Sharon West

# data[].attributes.body
We all have done extensive research on muscle recovery and stretching strategies for our original idea, some robotics experience, sports recovery experience

# data[].attributes.body
flow bow

wrist restorer

the stimulator

forearm massage brace

wristroller

# data[].attributes.body
Should we have a website or social media page?

# data[].attributes.body
Mueller Hg80 Tennis Elbow Brace - highly reviewed in recovery aspects, increases risk of shoulder pain

Recovery Pulse - full arm sleeve, same idea just doesn't work

Comfier Heated Knee Brace Wrap with Massage, Vibration Knee Massager with Heat - want to replicate for forearm

# data[].attributes.body
When the on button on the brace is clicked the Arduino board sends a message to the motors to turn on and start rotating the massage balls. When the button is clicked once more the Arduino board turns off the motors and stops the massage balls from rotating.

# data[].attributes.body
Who will be interested in our product?

at-home workers, frequent typers

athletes, weight lifters

laborers who carry heavy objects

adults that work from home

tennis players

athletes

climbers

# data[].attributes.body
muscles can become longer and elastic over time with flexibility training, but they will gradually return to their original length without consistent stretching (like a rubber band)

# data[].attributes.body
Muscle fibers (myofilaments) held together by sarcomeres (composed of the protein filaments actin and myosin) like a coil or a spring

Muscle Development: Muscle fibers damaged due to overload are healed through hypertrophy (muscle fibers increasing in size) and hyperplasia (number of muscle fibers increasing

Can also adapt by increasing capillary density for greater oxygenation which increases mitochondrial density and improves aerobic capacity in the muscles

# data[].attributes.body
ice

rest

stretching

cortisone injections

prescription medications

physical therapy

surgery

(none of these allow for pain relief and work efficiency)

# data[].attributes.body
cost, efficiency, market appeal, profit

# data[].attributes.body
quality of product

effectiveness

price

# data[].attributes.body
Proven to relax tension on muscles, tendons, and joints

Eases pressure on tendons and softens pain

Can relieve stress and anxiety

Vibrations warm up muscles & direct blood blood to tense areas

# data[].attributes.body
compression arm sleeve

micro arduino (on/off button)

H bridge

wires

small motors

massage balls (3D print?)

velcro

battery pack w/ batteries

# data[].attributes.attachment_link.readable_text
Learn how to wire and program a pushbutton to control an LED.

Pushbuttons or switches connect two points in a circuit when you press them. This example turns on the built-in LED on pin 13 when you press the button.

Hardware

Circuit

Connect three wires to the board. The first two, red and black, connect to the two long vertical rows on the side of the breadboard to provide access to the 5 volt supply and ground. The third wire goes from digital pin 2 to one leg of the pushbutton. That same leg of the button connects through a pull-down resistor (here 10K ohm) to ground. The other leg of the button connects to the 5 volt supply.

When the pushbutton is open (unpressed) there is no connection between the two legs of the pushbutton, so the pin is connected to ground (through the pull-down resistor) and we read a LOW. When the button is closed (pressed), it makes a connection between its two legs, connecting the pin to 5 volts, so that we read a HIGH.

You can also wire this circuit the opposite way, with a pullup resistor keeping the input HIGH, and going LOW when the button is pressed. If so, the behavior of the sketch will be reversed, with the LED normally on and turning off when you press the button.

If you disconnect the digital I/O pin from everything, the LED may blink erratically. This is because the input is "floating" - that is, it will randomly return either HIGH or LOW. That's why you need a pull-up or pull-down resistor in the circuit.

Schematic

Code

Learn more

You can find more basic tutorials in the built-in examples section.

You can also explore the language reference, a detailed collection of the Arduino programming language.
Last revision 2015/07/28 by SM

# data[].attributes.attachment_link.description
Learn how to wire and program a pushbutton to control an LED. Pushbuttons or switches connect two points in a circuit when you press them. This example turns on the built-in LED on pin 13 when you press the button. Connect three wires to the board.

# data[].attributes.body
Not many braces on the market with massaging component, especially for the forearm

Our product specifically aids in the muscle recovery and tension relief for "tennis elbow"

# data[].attributes.body
CLAB - combo of our initials

also sounds like collab which is one of the 6 C's

# data[].attributes.body
computer elbow (top of arm)

golfers elbow (outer elbow, upper forearm)

tennis elbow (inner, top of forearm)

# data[].attributes.body
how much power does the motor need?

what volt battery to power the motor?

kinetic watches?

# data[].attributes.body
We will use CAD design software to model our prototype before actually getting started. We've practiced using this software through the assignments on the engineering website.

# data[].attributes.body
Test prototype after wiring motors to arduino and power source

Can have people who have suffered from tennis elbow test

Record how long the brace is effective for

Record strength of motors under compression sleeve

# data[].attributes.body
We will update with the takeaways from our survey results by Feb. 16

Survey approved by mentors and sent to sub groups of market

# data[].attributes.body
This is our GoFundMe

# data[].attributes.attachment_link.readable_text
Hi! This is Catherine Louie, Logan MacDonald, Analiese Engler, and Blossom Pinto and we are C.L.A.B.. This year for our STEM Capstone Project, we have the opportunity to create a product using the engineering design cycle and collaborating with experts to mentor us along the way. We decided to focus in on mechanically engineering a product to combat a condition that has directly affected our loved ones. (design shown in the photo above)

Since 2020, the time spent regularly working at a computer has increased exponentially, making conditions such as "computer elbow" become more common. This is usually due to overuse of the muscles in the forearm that aid in extending the arm or gripping an object. Microtears and inflammation can develop on the lateral epicondyle on the outside of the elbow. The WristRoller has reliable massage technology designed to relieve any tension the user may have. The two rotating wheels of massage balls apply soothing pressure all across the forearm. Adjusting the fit and tightness is easy and simple with the secure velcro straps. This enables the user to continue with their daily work activities without the distracting pain. The specific benefits to our idea include a more compact and visually appealing product than the existing models, a comfortable and wearable massager, and a device that provides a deep and satisfying relief of muscle tension.

Any donations made will be greatly appreciated as we work to develop solid prototypes and learn more about the engineering process. We hope our product can make a solid impact on anyone who struggles with tension in their forearms.

Read more

Your easy, powerful, and trusted home for help

Easy

Donate quickly and easily.

Powerful

Send help right to the people and causes you care about.

# data[].attributes.attachment_link.title
C.L.A.B.'s Senior Engineering Project, organized by Analiese Engler

# data[].attributes.attachment_link.description
Hi! This is Catherine Louie, Logan MacDonald, Analiese Engler, and Blossom Pint... Analiese Engler needs your support for C.L.A.B.'s Senior Engineering Project

# data[].attributes.body
wrist brace w/ heating component for muscle recovery

# data[].attributes.body
wrist brace w/ electro-stimulation along arm to activate muscles in shocking way

# data[].attributes.body
same functional brace concept (lightweight, massaging) but for calf or quad

# data[].attributes.body
forearm brace that measures pulse in day-to-day activities and while exercising. could be used for medical reasons

# data[].attributes.body
includes:

Toshiba motor driver, the TB6612FNG, which can drive two motors

An H-bridge circuit on motor driver for braking and switching direction

Each motor driver has a PWM input because they are expected to be used for speed control for the motor by pulse width modulating this pin

# data[].attributes.attachment_link.readable_text
In this tutorial, you'll learn how to control a DC motor's direction using a DC Motor Driver.

To reverse a DC motor, you need to be able to reverse the direction of the current in the motor. The classic way to do this is using an H-bridge circuit. Though most motor driver chips these days are not in fact H-bridge circuits, the term still persists. This tutorial uses a Toshiba motor driver, the TB6612FNG, which can actually drive two DC motors. Both Sparkfun, Adafruit, and Pololu make breakout boards for the motor driver, though the Sparkfun one is shown in the examples below.

At the end of the lab, an alternative motor driver, the L9110H, is shown. This motor driver can only drive one motor at a time, unlike the TB6612FNG, but it's more inexpensive than the TB6612FNG.

If you simply want to turn a motor on and off, and don't need to reverse it, for example if you're controlling a fan, try the tutorial on controlling high current loads with transistors.

What You'll Need to Know

To get the most out of this lab, you should be familiar with the following concepts. You can check how to do so in the links below:

Things You'll Need

Prepare the breadboard

Connect power and ground on the breadboard to power and ground from the microcontroller. On the Arduino module, use the 5V or 3.3V (depending on your model) and any of the ground connections, as shown in Figures 10 and 11.

Figure 10. Breadboard drawing of an Arduino Uno on the left connected to a solderless breadboard on the right

Figure 10 shows an Arduino Uno on the left connected to a solderless breadboard, right. The Uno's 5V output hole is connected to the red column of holes on the far left side of the breadboard. The Uno's ground hole is connected to the blue column on the left of the board. The red and blue columns on the left of the breadboard are connected to the red and blue columns on the right side of the breadboard with red and black wires, respectively. These columns on the side of a breadboard are commonly called the buses. The red line is the voltage bus, and the black or blue line is the ground bus.

Figure 11. Breadboard view of an Arduino Nano mounted on a solderless breadboard.

As shown in Figure 11, the Nano is mounted at the top of the breadboard, straddling the center divide, with its USB connector facing up. The top pins of the Nano are in row 1 of the breadboard.

The Nano, like all Dual-Inline Package (DIP) modules, has its physical pins numbered in a U shape, from top left to bottom left, to bottom right to top right. The Nano's 3.3V pin (physical pin 2) is connected to the left side red column of the breadboard. The Nano's GND pin (physical pin 14) is connected to the left side black column. These columns on the side of a breadboard are commonly called the buses. The red line is the voltage bus, and the black or blue line is the ground bus. The blue columns (ground buses) are connected together at the bottom of the breadboard with a black wire. The red columns (voltage buses) are connected together at the bottom of the breadboard with a red wire.
Images made with Fritzing
Add a Digital Input (pushbutton or switch)

Connect a pushbutton to digital input 2 on the Arduino. Figure 12 shows the schematic, Figure 13 shows the breadboard view for the Uno, and Figure 14 the breadboard view for the Nano.

Figure 12. Schematic Diagram of a pushbutton attached to an Arduino as a digital input. A 10-kilohm resistor connects from the pushbutton to ground.

Figure 13. Breadboard view of a pushbutton attached to an Arduino Uno. The Arduino is connected to a breadboard as described in the image above. A pushbutton is mounted in across the center section of the breadboard. A red wire connects from the left side voltage bus to the lower right pin of the pushbutton. A blue wire connects the upper left pin of the pushbutton to digital pin 2 on the Arduino. A 10-kilohm resistor connects the upper right pin of the pushbutton to the ground bus on the left side of the board.

Figure 14. Breadboard view of a pushbutton attached to an Arduino Nano 33 IoT.

As shown in Figure 14, the Nano is mounted across the center divide of the breadboard with the USB connector pointing up. A pushbutton is mounted in across the center section of the breadboard. A red wire connects from the left side voltage bus to the lower right pin of the pushbutton. A blue wire connects the upper left pin of the pushbutton to digital pin 2 on the Arduino. A 10-kilohm resistor connects the upper right pin of the pushbutton to the ground bus on the left side of the board.

Find a motor

Find yourself a DC motor that runs on low DC voltage within the range of 3 - 15V. This one works well for this, or this one or this one. Discarded toys and printers can be good sources of these also. The ITP free store is almost always a goldmine for discarded motors and fans. Asking classmates and second years is another good approach.

Solder leads to the motor's terminals. The motor's direction depends on the polarity, so it's helpful to use different colors so you know which way the motor will turn when you hook it up.

Optional: Consider testing your motor with a bench power supply from the equipment room. Ask a teacher or resident if you need help setting one up. Begin by adjusting the voltage on the bench power supply and observe its effects. Take note of its speed at different voltages without dipping to low or too high.

Safety Warning: Running a motor at a voltage much lower or much higher than what it's rated for could potentially damage or permanently destroy your motor. When the motor doesn't spin, the voltage is too low. When the motor runs hot, or sounds like it's straining, the voltage is too high.

Powering Your Motor

If your motor can run on 5V (if you're using an Uno) or 3.3V (if using a Nano 33 IoT ) and less than 500mA, you can use the Arduino's USB voltage. Most motors require a higher voltage and higher current draw than this, however, so you will need an external power supply. You can use any DC power supply or battery up to 15V with this motor driver as long as your motor can run at that voltage, and as long as the supply can supply as much current as your motor needs. However you choose to power this circuit, make sure the power source is compatible with your motor. For example, don't use a 9V battery for a 3V motor.

The diagrams below show how to power the motor from an external power supply. To power directly from the Arduino's V cc, connect the V MOT pin of the motor driver to the V cc pin on the Arduino (5V on Uno, 3.3V on Nano)

Set up the Motor Driver

This tutorial uses a Toshiba motor driver, the TB6612FNG, which can actually drive two motors.There's a Sparkfun breakout board, an Adafruit breakout board, and a Pololu breakout board for this part as well.

How The Motor Driver Works

The TB6612FNG can handle a motor supply voltage up to 15V, and it operates on a logic voltage of 2.7-5.5V. It can control an output current of 1.2A. It has two motor driver circuits, each with two logic inputs and two motor outputs. Each motor driver has a PWM input, because they are expected to be used for speed control for the motor by pulse width modulating this pin. There's also a Standby pin that you have to connect to voltage through a 10-kilohm pullup resistor to activate the motor driver circuits.

The motor driver has the following pins. The pin numbers shown here are for the Sparkfun breakout board. The order of the pins will be different for the Adafruit and Pololu boards. The Pins are numbered here in a DIP fashion, in a U-shape from top left to bottom left, then bottom right to top right.

VMOT - motor voltage supply input, up to 15V.

Vcc - logic voltage supply input, 2.7-5.5V

Gnd - ground

AO1 - A channel output 1. This is the first motor terminal for the first motor driver

AO2 - A channel output 2. This is the second motor terminal for the first motor driver

BO2 - B channel output 2. This is the second motor terminal for the second motor driver

BO1 - B channel output 1. This is the first motor terminal for the second motor driver

Gnd - ground

Gnd - ground

PWMB - B Channel PWM Enable. This pin controls the speed for channel B, regardless of the channel's direction

BI2 - B channel input 2. This controls B channel output 2. To control that pin, take this pin HIGH or LOW.

BI1 - B channel input 1. This controls B channel output 1. To control that pin, take this pin HIGH or LOW.

Stdby - enables both drivers when you take it HIGH and disables them when you take it LOW

AI1 - A channel input 1. This controls A channel output 1. To control that pin, take this pin HIGH or LOW.

AI2 - A channel input 2. This controls A channel output 2. To control that pin, take this pin HIGH or LOW.

PWMA - A Channel PWM Enable. This pin controls the speed for channel A, regardless of the channel's direction

Figure 15 shows the Sparkfun board, and Figures 16 and 17 show the Pololu board front and back. The Pololu board is labeled on the back. You can see that both boards have the same pins, even though the layouts are different.

Figure 15. Motor Driver (H-bridge), model TB6612FNG

Figure 16. Pololu's TB6612FNG Dual Motor Driver Carrier (front view of the board)

Figure 17. Pololu's TB6612FNG Dual Motor Driver Carrier (back of the board)

You can change the direction and speed of the motor using the motor driver. The truth table below shows how the motor driver works.

For this lab, the PWMA pin connects to a digital pin on your Arduino so you can send it either HIGH or LOW and turn the motor ON or OFF, or pulse width modulate it to control the speed. The motor logic pins are also connected to designated digital pins on your Arduino so you can set them HIGH and LOW to turn the motor in one direction, or LOW and HIGH to turn it in the other direction. The motor supply voltage connects to the voltage source for the motor, which is usually an external power supply.

Connect the motor to the Driver

Connect the motor to the driver as shown in Figures 18 - 20. Figure 18 shows the schematic, Figure 19 shows the breadboard view for an Uno, and Figure 20 shows the breadboard view for a Nano.

Figure 18. Schematic diagram of an Arduino connected to a motor driver to control a DC motor. The Arduino and switch are connected as described in the drawing above. A motor driver has been added, and is connected as follows: PWMA is connected to the Arduino's digital pin 5. AIN1 is connected to digital pin 4. AIN2 is connected to digital pin 3 on the Arduino. AO1 and AO2 are connected to the DC motor's two connections. The ground pins are connected to ground. VMOT is connected to the positive terminal of a DC power source for Arduino and the motor. The power source's negative terminal is connected to ground. The motor driver's Vcc pin is connected to the Arduino's voltage output (5V or 3.3V depending on your model). The Standby pin is connected to voltage through a 10-kilohm resistor. The rest of the driver pins are unconnected.

Figure 19. Breadboard drawing of an Arduino connected to a motor driver to control a DC motor. The Arduino and switch are connected as described in the breadboard drawing above. A motor driver has been added, straddling the center of the breadboard. PWMA is connected to the Arduino's digital pin 5. AIN1 is connected to digital pin 4. AIN2 is connected to digital pin 3 on the Arduino. AO1 and AO2 are connected to the DC motor's two connections. The ground pins are connected to ground. VMOT is connected to the VIN terminal the Arduino, and the Arduino should be powered through its DC power jack. The power source's negative terminal is connected to ground. The motor driver's Vcc pin is connected to the Arduino's voltage output (5V for the Uno). The Standby pin is connected to voltage through a 10-kilohm resistor. The rest of the driver pins are unconnected. A 100-microfarad capacitor has been added connecting the voltage and ground buses close to the motor driver, to act as a decoupling capacitor.

Figure 20. Breadboard drawing of an Arduino Nano connected to a motor driver to control a DC motor. The Arduino and switch are connected as described in the breadboard drawing above. A DC power jack has been added, connected to the Nano's ground and Vin pin (pins 14 and 15, respectively). A motor driver has been added, straddling the center of the breadboard. PWMA is connected to the Arduino's digital pin 5. AIN1 is connected to digital pin 4. AIN2 is connected to digital pin 3 on the Arduino. AO1 and AO2 are connected to the DC motor's two connections. The ground pins are connected to ground. VMOT is connected to the Nano's Vin pin, which is connected to the positive terminal of the DC power source for the motor. The power source's negative terminal is connected to ground. The motor driver's Vcc pin is connected to the Arduino's voltage output (3.3V). The Standby pin is connected to voltage through a 10-kilohm resistor. The rest of the driver pins are unconnected. A 100-microfarad capacitor has been added connecting the voltage and ground buses close to the motor driver, to act as a decoupling capacitor.

Note on decoupling capacitors

If you find that your microcontroller is resetting whenever the motor turns on, add a capacitor across power and ground close to the motor. The capacitor will smooth out the voltage dips that occur when the motor turns on. This use of a capacitor is called a decoupling capacitor. Usually a 10 - 100uF capacitor will work. The larger the cap, the more charge it can hold, but the longer it will take to release its charge.

Program the microcontroller

Program the microcontroller to run the motor through the driver. First set up constants for the switch pin, the two motor driver pins, and the PWM enable pin of the motor driver. Use pin 5, one of the pins that can produce a PWM signal using analogWrite(), for the PWM enable pin.

const int switchPin = 2;    // switch input
const int motor1Pin = 3;    // Motor driver leg 1 (pin 3, AIN1)
const int motor2Pin = 4;    // Motor driver leg 2 (pin 4, AIN2)
const int pwmPin = 5;       // Motor driver PWM pin

In the setup(), set all the pins for the motor driver as outputs, and the pin for the switch as an input. Then set the PWM enable pin high so the driver can turn the motor on.

void setup() {
    // set the switch as an input:
    pinMode(switchPin, INPUT);

    // set all the other pins you're using as outputs:
    pinMode(motor1Pin, OUTPUT);
    pinMode(motor2Pin, OUTPUT);
    pinMode(pwmPin, OUTPUT);

    // set PWM enable pin high so that motor can turn on:
    digitalWrite(pwmPin, HIGH);
  }

In the main loop() read the switch. If it's high, turn the motor one way by taking one motor driver pin high and the other low. If the switch is low, reverse the direction by reversing the states of the two pins.

void loop() {
    // if the switch is high, motor will turn on one direction:
    if (digitalRead(switchPin) == HIGH) {
      digitalWrite(motor1Pin, LOW);   // set leg 1 of the motor driver low
      digitalWrite(motor2Pin, HIGH);  // set leg 2 of the motor driver high
    }
    // if the switch is low, motor will turn in the other direction:
    else {
      digitalWrite(motor1Pin, HIGH);  // set leg 1 of the motor driver high
      digitalWrite(motor2Pin, LOW);   // set leg 2 of the motor driver low
    }
  }

Once you've seen this code working, try modifying the speed of the motor using the analogWrite() function, as explained in the Analog Lab. Use analogWrite() on the PWM enable pin of the motor, and see what happens as you change the value of the analogWrite().

An Alternative Motor Driver

If you don't have a TB6612FNG motor driver, or if you want something simpler and less expensive, the L9110H driver will also control a DC motor's direction and speed. It can handle and input voltage of 2.5V-12V at 800mA of current. It can drive only one motor, unlike the TB6612FNG, and it can't control stepper motors like that driver can. But it is inexpensive.

THe L9110H comes in an 8-pin DIP package. There are two inputs, labeled the A and B channels, and they are connected to two outputs, also labeled A and B. Your motor connects to the outputs and your control pins connect to the inputs. V cc connects to the motor supply and GND connects to ground. Its pins, numbered from top left in a U shape as usual, are as follows:

1. OA - output for the A channel

2. Vcc - motor supply voltage

3. Vcc - motor supply voltage

4. OB output for the B channel

5. GND - ground

6. IA - input for the A channel

7. IB - input for the B channel

8. GND - ground

Figure 21 shows the schematic, and Figures 22 and 23 show it connected to an Uno and a Nano 33 IoT, respectively.

Figure 21. Schematic view of an L9110H H-bridge motor driver connected to an Arduino. A pushbutton is connected to pin 2 of the Arduino as shown in the circuits above. An external DC power supply is connected to the Arduino and the motor as shown in the circuits above as well, along with a 100-microfarad decoupling capacitor. A DC motor is connected to pins OA and OB of the H-bridge. Pins Vcc are both connected to the DC power supply and pins GND are connected to ground. Pin IA is connected to pin 5 of the Arduino, and pin IB is connected to pin 6 of the Arduino.

Figure 22. Breadboard view of an L9110H H-bridge motor driver connected to an Arduino Uno. A pushbutton is connected to pin 2 of the Arduino as shown in the circuits above. The L9110H straddles the center divide of the breadboard with pins 1 and 8 facing the top of the diagram. The Arduino should be powered through its DC power jack. The Vin pin of the Arduino connects to the L9110H's Vcc pins (physical pins 2 and 3). The motor is connected to the L9110H's OA and OB pins (physical pins 1 and 4). A 100-microfarad decoupling capacitor is connected to the voltage and ground buses on the breadboard. Pins GND (physical pins 5 and 8) are connected to ground. Pin IA (physical pin 6) is connected to pin 5 of the Arduino, and pin IB (physical pin 6) is connected to pin 6 of the Arduino.

Figure 23. Breadboard drawing of an Arduino Nano connected to a L9110H H-bridge motor driver to control a DC motor. The Arduino and switch are connected as described in the breadboard drawing above. A DC power jack has been added, connected to the Nano's ground and Vin pin (pins 14 and 15, respectively). The L9110H straddles the center divide of the breadboard with pins 1 and 8 facing the top of the diagram. The Vin pin of the Arduino connects to the L9110H's Vcc pins (physical pins 2 and 3). The motor is connected to the L9110H's OA and OB pins (physical pins 1 and 4). A 100-microfarad decoupling capacitor is connected to the voltage and ground buses on the breadboard. THe L9110H's ins GND (physical pins 5 and 8) are connected to ground. Pin IA (physical pin 6) is connected to pin 5 of the Nano, and pin IB (physical pin 6) is connected to pin 6 of the Nano.

To control the motor, you take one input high and the other low, just like with the previous motor driver. Since this driver has no PWM pin, you have to pulsewidth modulate the high input to manage speed control, though.

The program below controls the L9110H, setting the speed to about half the maximum whenever you push the button. To make a variable speed you could add a potentiometer and change the value of the speed variable using the potentiometer.

const int switchPin = 2;  // pushbutton input
const int motor1Pin = 5;  // H-bridge leg 1 (pin 6, 1A)
const int motor2Pin = 6;  // H-bridge leg 2 (pin 7, 2A)

// speed of the motor (0-255):
int speed = 127;

void setup() {
  // set the pushbutton as an input:
  pinMode(switchPin, INPUT);

  // set all the other pins you're using as outputs:
  pinMode(motor1Pin, OUTPUT);
  pinMode(motor2Pin, OUTPUT);
}

void loop() {
  // if the pushbutton is high, motor will turn on one direction:
  if (digitalRead(switchPin) == HIGH) {
    // set leg 1 of the H-bridge low:
    digitalWrite(motor1Pin, LOW);
    // set leg 2 of the H-bridge high:
    analogWrite(motor2Pin, speed);
  }
  // if the pushbutton is low, motor will turn in the other direction:
  else {
    // set leg 1 of the H-bridge high:
    digitalWrite(motor1Pin, speed);
    // set leg 2 of the H-bridge low:
    digitalWrite(motor2Pin, LOW);
  }
}

Get creative

Motors can be used to make things move, vibrate, rise, fall, roll, creep, or whatever you can think of, in response to user input from a digital input device (switch, floor sensor, tripwire, etc). Look inside moving toys, you'll find a number of excellent motors and gears you can re-purpose. See the innards of a cymbal monkey below as an example. Perhaps you can re-design the user interface to a toy, using the microcontroller to mediate between new sensors on the toy and the motors of the toy.

If you used a motor in this lab, consider any toys you have that have a motor you could take control over. Charley Chimp ™ has a motor that's easy to control from an Arduino, for example.

Figure 21. The guts of a Charley Chimp™ cymbal-playing monkey.

You could also consider simple movements in the work of artists like Jennifer Townley, Johannes Langenkamp ( instagram), Nick Yulman, or Lu Lyu.

# data[].attributes.attachment_link.description
In this tutorial, you'll learn how to control a DC motor's direction using a DC Motor Driver. To reverse a DC motor, you need to be able to reverse the direction of the current in the motor. The classic way to do this is using an H-bridge circuit.