Serial.begin(9600);
}
//==========================================================================
=====
// Main
//==========================================================================
=====
void loop()
{
// Run both motors Forward at 75% power
Motor('C', 'F', 75);
delay(3000);
// Run both motors in Reverse at 75% power but sound beeper first
Motor('C', 'F', 0); // Stop motors
delay(1000);
digitalWrite(BUZZER,HIGH);delay(500);digitalWrite(BUZZER,LOW);
delay(500);
digitalWrite(BUZZER,HIGH);delay(500);digitalWrite(BUZZER,LOW);
delay(1000);
Motor('C', 'R', 75); // Run motors forward at 75%
delay(3000);
// now run motors in opposite directions at same time at 50% speed
Motor('A', 'F', 50);
Motor ('B', 'R', 50);
delay(3000);
// now turn off both motors
Motor('C', 'F', 0);
delay(3000);
// Run the motors across the range of possible speeds in both directions
// Maximum speed is determined by the motor itself and the operating voltage
// Accelerate from zero to maximum speed
for (int i = 0; i <= 100; i++)
{
Motor('C', 'F', i);
delay(ACCEL_DELAY);
}
delay (2000);
// Decelerate from maximum speed to zero
for (int i = 100; i >= 0; --i)
{
Motor('C', 'F', i);
delay(ACCEL_DELAY);
}
delay (2000);
// Set comm speed for serial monitor messages
Need help?
Do you have a question about the Uno and is the answer not in the manual?