Pages: [1]   Go Down
Author Topic: Arduino Robot  (Read 1044 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 0
Posts: 61
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

so here is the code
Code:
#include <AFMotor.h>

AF_DCMotor motor1(1);
AF_DCMotor motor2(2);
AF_DCMotor motor3(3);
AF_DCMotor motor4(4);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Motor test!");
 
  motor1.setSpeed(255);
  motor2.setSpeed(255);
  motor3.setSpeed(255);   
  motor4.setSpeed(255);     
}

void loop() {
 
  Serial.print("for");
  motor1.run(FORWARD); 
  motor2.run(FORWARD);
  motor3.run(FORWARD); 
  motor4.run(FORWARD); 
  delay(5000);

  Serial.print("back");
  motor1.run(BACKWARD);
  motor2.run(BACKWARD);
  motor3.run(BACKWARD);
  motor4.run(BACKWARD);   
  delay(5000);
 
  Serial.print("tack");
  motor1.run(RELEASE);
  motor2.run(RELEASE); 
  motor3.run(RELEASE);
  motor4.run(RELEASE); 
  delay(5000);

}

When i use it look what i get :


Why is it doing that to go to the front??
Logged

Pages: [1]   Go Up
Jump to: