2012-02-19_21.04.01.jpg (387574Bytes)
2012-02-19_21.06.32.jpg (547970Bytes)
2012-02-19_21.07.00.jpg (661765Bytes)
2012-02-19_21.07.22.jpg (576094Bytes)
2012-02-19_21.07.39.jpg (543058Bytes)
Oke, Introducing my first "robot".
Works on 2x sn754410ne, stacked on each other.
Arduino UNO R3
2 push buttons (left motor/right motor)
Tamiya twin-motor gearbox
Everything is powered with the 5V of the Arduino UNO R3. So no external power source.
Thinking of using a LIPO battery, but don't know which one, what voltage etc. etc., so any advice is appreciated.
Planning on making it wireless over WiFi and add two arms so it can pull itself on stuff and add a camera
const int motor1Pin1 = 3; // pin 2 on 754
const int motor1Pin2 = 4; // pin 7 on 754
const int enable1Pin = 9; // pin 1 on 754
const int motor2Pin1 = 5; // pin 10 on 754
const int motor2Pin2 = 6; // pin 15 on 754
const int enable2Pin = 10; // pin 9 on 754
const int buttonPin = 2;
const int button2Pin = 12;
int buttonState = 0;
int button2State = 0;
void setup() {
// set the motor pins as outputs:
pinMode(motor1Pin1, OUTPUT);
pinMode(motor1Pin2, OUTPUT);
pinMode(enable1Pin, OUTPUT);
pinMode(motor2Pin1, OUTPUT);
pinMode(motor2Pin2, OUTPUT);
pinMode(enable2Pin, OUTPUT);
// set enablePins high so that motor can turn on:
digitalWrite(enable1Pin, HIGH);
digitalWrite(enable2Pin, HIGH);
pinMode(buttonPin, INPUT);
pinMode(button2Pin, INPUT);
}
void loop() {
// check the average distance and move accordingly
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(motor1Pin1, HIGH);
digitalWrite(motor1Pin2, LOW);
}
else {
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, LOW);
}
button2State = digitalRead(button2Pin);
if (button2State == HIGH) {
// turn LED on:
digitalWrite(motor2Pin1, HIGH);
digitalWrite(motor2Pin2, LOW);
}
else {
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, LOW);
}
}
PINS
1 to pin 9 on Arduino board
2 to pin 3 on Arduino board
3 to motor1
4 to the gnd rail on the breadboard
5 to the gnd rail on the breadboard
6 to motor1
7 to pin 4 Arduino
8 to power (+) rail.
9 to pin 10 Arduino
10 to pin 5 Arduino
11 to motor2
12 to GND rail
13 to GND rail
14 to motor2
15 to pin 6 Arduino
16 to power (+) rail
And here are more images, of the board and wires. ( ATTACHMENTS!)
https://www.youtube.com/watch?v=uQN_JcKMCT4