// Motor Driver
// Darcy Chang
// 6/6/19
// Arduino 1.8.5
const int
OnBoardPin = 13;
const int Dlay = 20;
void setup()
{
// put your setup code here, to run once:
pinMode(9,OUTPUT); // set the pin modes to output
pinMode(10, OUTPUT);
pinMode(11,OUTPUT);
pinMode(12,OUTPUT);
pinMode(OnBoardPin,OUTPUT);
}
void loop()
{
// put your main code here to run repeatedly:
blinky();
forward();
}
void blinky()
{
digitalWrite(OnBoardPin, LOW); // flash on board LED
delay(Dlay);
digitalWrite(OnBoardPin, HIGH);
delay(Dlay);
}
void forward()
{
digitalWrite(9, HIGH); // make left motor move forward
digitalWrite(10,LOW);
digitalWrite(11,HIGH); // make right motor move forward
digitalWrite(12,LOW);
}
void stopBot()
{
digitalWrite(9,LOW); // stop both motors
digitalWrite(10,LOW);
digitalWrite(11,LOW);
digitalWrite(12,LOW);
}