32 lines
549 B
C++
32 lines
549 B
C++
#include <MeMCore.h>
|
|
|
|
MeDCMotor leftRotor(9);
|
|
MeDCMotor rightRotor(10);
|
|
float lSpeed;
|
|
float rSpeed;
|
|
float duration;
|
|
|
|
void setup() {
|
|
// put your setup code here, to run once:
|
|
leftRotor.run(0);
|
|
rightRotor.run(0);
|
|
lSpeed = -100.0;
|
|
rSpeed = 100.0;
|
|
duration = 1000.0;
|
|
|
|
}
|
|
|
|
void loop() {
|
|
// put your main code here, to run repeatedly:
|
|
leftRotor.run(lSpeed);
|
|
rightRotor.run(rSpeed);
|
|
delay(duration);
|
|
leftRotor.stop();
|
|
rightRotor.stop();
|
|
delay(duration);
|
|
leftRotor.run(0-lSpeed);
|
|
rightRotor.run(0-rSpeed);
|
|
delay(duration);
|
|
|
|
}
|