In this unit you will learn how to use an H-Bridge to make a motor run forwards and backwards.
You need a special integrated circuit (IC) called an H-bridge. It is shown with the code 293D in the diagram below.
Make sure that you have connected pins 10 and 12 on the H-bridge to the Arduino.
Then type this code into Arduino:
void setup()
{
pinMode(10,OUTPUT);
pinMode(12,OUTPUT);
}
void loop()
{
digitalWrite(10,HIGH);
digitalWrite(12,LOW);
delay(1000);
digitalWrite (10,LOW);
digitalWrite(12, HIGH);
delay(1000);
Before you try to download the code into your Arduino board click on the Tools menu and make sure you have ticked the COM port that your Arduino is connected to.