Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Another benefit can be the use of an H-bridge to control a stepper motor. This tutorial shows how to do this.

Example

1x Arduino
1x H-Brücke Bridge SN754410 (DatesheetDatasheet)
1x DC Motor 

Image RemovedImage Added

Code Block
languagec#
titleExampled Example Motor
collapsetrue
#define MOTOR_PIN_A 5
#define MOTOR_PIN_B 6
void setup() 
{
  pinMode(MOTOR_PIN_A, OUTPUT);
  pinMode(MOTOR_PIN_B, OUTPUT);
}
void loop() 
{
  //One direction
  digitalWrite(MOTOR_PIN_A, HIGH);
  digitalWrite(MOTOR_PIN_B, LOW);
  delay(5000);
  
  //The other direction
  digitalWrite(MOTOR_PIN_A, LOW);
  digitalWrite(MOTOR_PIN_B, HIGH);
  delay(5000);
}

...

Further Information:

H-Bridge - Wikipedia


Using Two Motors

Here is an example with two motors. Remember, you can supply 9 volts to the VIN pin on the Arduino to run everything with the 9-volt battery. 

Image Added