Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <AFMotor.h>
- AF_DCMotor motor1(1);
- AF_DCMotor motor2(2);
- void setup() {
- motor1.setSpeed(255);
- motor2.setSpeed(255);
- motor1.run(RELEASE);
- motor2.run(RELEASE);
- }
- void loop() {
- FRONT();
- delay(2000);
- BACKWARDS();
- delay(2000);
- LEFT();
- delay(2000);
- RIGHT();
- delay(2000);
- }
- void FRONT() {
- motor1.run(FORWARD);
- motor2.run(FORWARD);
- }
- void BACKWARDS() {
- motor1.run(BACKWARD);
- motor2.run(BACKWARD);
- }
- void LEFT() {
- motor1.run(FORWARD);
- motor2.run(BACKWARD);
- }
- void RIGHT() {
- motor1.run(BACKWARD);
- motor2.run(FORWARD);
- }
- void STOPP() {
- motor1.run(RELEASE);
- motor2.run(RELEASE);
- }
Advertisement
Add Comment
Please, Sign In to add comment