Skip to content

Instantly share code, notes, and snippets.

@samthetechie
Created September 8, 2011 23:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samthetechie/1205051 to your computer and use it in GitHub Desktop.
Save samthetechie/1205051 to your computer and use it in GitHub Desktop.
TRTL Testing Code for H-Bridge Control of Motors
#define EN_1_2 12
#define EN_3_4 7
#define INPUT_1A 11
#define INPUT_2A 10
#define INPUT_4A 8
#define INPUT_3A 9
void setup()
{
pinMode(EN_1_2, OUTPUT);
pinMode(EN_3_4, OUTPUT);
pinMode(INPUT_1A, OUTPUT);
pinMode(INPUT_2A, OUTPUT);
pinMode(INPUT_3A, OUTPUT);
pinMode(INPUT_4A, OUTPUT);
digitalWrite(EN_1_2, HIGH);
digitalWrite(EN_3_4, HIGH);
}
void loop()
{
digitalWrite(INPUT_1A, HIGH);
digitalWrite(INPUT_2A, LOW);
digitalWrite(INPUT_3A, HIGH);
digitalWrite(INPUT_4A, LOW);
delay(10000); // wait for a second
digitalWrite(INPUT_1A, LOW);
digitalWrite(INPUT_2A, HIGH);
digitalWrite(INPUT_3A, LOW);
digitalWrite(INPUT_4A, HIGH);
delay(10000); // wait for a second
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment