Simple bot v0.1

Here are some pictures of my simple bot. It doesn't do anything special, it just goes forward, turns, goes backwards, turns, etc.

It's arduino powered, and uses a SN754410 H-bridge motor driver chip I bought at SparkFun.com.

Now, I need some batteries... :-)

Update (13/5/08)

These photo's got picked up by blog.makezine.com so I'll add the arduino code for those interested.
I'll try to add the scematics once I finished my terms. (20/6) If you want to try this at home, I recommend to take a look at the datasheet, it will help you a lot :-)

// By Batist Leman
int motor1Pin1 = 8; 
int motor1Pin2 = 9; 

int motor2Pin1 = 7; 
int motor2Pin2 = 6;   

int motorsPinEnable = 2;

void setup() {

  pinMode(motor1Pin1, OUTPUT); 
  pinMode(motor1Pin2, OUTPUT); 
  pinMode(motor2Pin1, OUTPUT); 
  pinMode(motor2Pin2, OUTPUT); 
  pinMode(motorsPinEnable, OUTPUT);
  pinMode(ledPin, OUTPUT);

  digitalWrite(motorsPinEnable,HIGH); 

}

void loop() {
    forward(3000);
     stop(3000);
    right(3000);
    stop(3000);
    backward(3000);
    stop(3000);
    right(3000);
   stop(3000);
   forward(3000);
    stop(3000);
}

void forward(int del){
    digitalWrite(motorsPinEnable,HIGH);
    digitalWrite(motor1Pin1, LOW); 
    digitalWrite(motor1Pin2, HIGH);
    
    digitalWrite(motor2Pin1, HIGH); 
    digitalWrite(motor2Pin2, LOW);
   
    delay(del); 
    digitalWrite(motorsPinEnable,LOW);
}

void backward(int del){
    digitalWrite(motorsPinEnable,HIGH);
    digitalWrite(motor1Pin1, HIGH); 
    digitalWrite(motor1Pin2, LOW); 
    
    digitalWrite(motor2Pin1, LOW);
    digitalWrite(motor2Pin2, HIGH);
    
    delay(del); 
    digitalWrite(motorsPinEnable,LOW);
}

void left(int del){
    digitalWrite(motorsPinEnable,HIGH);
    digitalWrite(motor1Pin1, LOW); 
    digitalWrite(motor1Pin2, HIGH);  
    
    digitalWrite(motor2Pin1, LOW);
    digitalWrite(motor2Pin2, HIGH);
    
    delay(del);  
    digitalWrite(motorsPinEnable,LOW);
}

void right(int del){
    digitalWrite(motorsPinEnable,HIGH);
    digitalWrite(motor1Pin1, HIGH); 
    digitalWrite(motor1Pin2, LOW);  
    
    digitalWrite(motor2Pin1, HIGH);
    digitalWrite(motor2Pin2, LOW);
    
    delay(del); 
    digitalWrite(motorsPinEnable,LOW);
}

void stop(int del){
    digitalWrite(motorsPinEnable,LOW);
    delay(del);
    digitalWrite(motorsPinEnable,LOW);
}




Comments



Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Syndicate content