Help!!!
I have a project I've been tinkering with and can't figure out what I've done wrong. I have an Arduino UNO that I have used to control a bluetooth-connected rover. I decided to save my Arduino for prototyping other projects and instead breadboard it out with just the ATMega328p chip. The sketch runs flawlessly when the chip is in the Arduino. However when I put the same chip in the breadboard, I get nothing. I verified the wiring is correct based on the instructions here, and even went so far as to upload the "blink" sketch to the chip and run it from the breadboard. That sketch works perfectly, no hiccups whatsoever. Unfortunately the sketch that runs fine from the Arduino does nothing when I run it on the same chip on the breadboard. I have pictures attached. The posts seen are where I have the output coming from when I run the sketch - I removed those wires to make it easier to see the connections.
Again, the blink sketch works fine on the breadboard, but I get nothing with this sketch. With the blink sketch, when I use the "reset" button, the LED on 13 flashes twice quickly before starting the sketch. With the sketch that runs the rover, I get nothing when I reset it.
Is there something I'm missing that I need to add to the code to get this to work? The code I'm using is here:
int motor1Pin1 = 11; // pin 2 on L293D IC
int motor1Pin2 = 10; // pin 7 on L293D IC
int motor2Pin1 = 6; // pin 10 on L293D IC
int motor2Pin2 = 5; // pin 15 on L293D IC
int right = 5; //turet right
int left = 4; // turet left
int up = 3; //turet up down
int fire = 2; // fire
int state;
void setup() {
// sets the pins as outputs:
pinMode(motor1Pin1, OUTPUT);
pinMode(motor1Pin2, OUTPUT);
//pinMode(enable1Pin, OUTPUT);
pinMode(motor2Pin1, OUTPUT);
pinMode(motor2Pin2, OUTPUT);
pinMode(up, OUTPUT);
pinMode(fire, OUTPUT);
pinMode(right, OUTPUT);
pinMode(left, OUTPUT);
Serial.begin(9600);
}
void loop() {
//if some date is sent, reads it and saves in state
if(Serial.available() > 0){
state = Serial.read();
}
// forward
if (state == 'w') {
digitalWrite(motor1Pin1, HIGH);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, HIGH);
}
// left
else if (state == 'e') {
digitalWrite(motor1Pin1, HIGH);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, HIGH);
digitalWrite(motor2Pin2, LOW);
}
// right
else if (state == 'q') {
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, HIGH);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, HIGH);
}
// up left
else if (state == 'a') {
digitalWrite(motor1Pin1, HIGH);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, LOW);
}
// up right
else if (state == 's') {
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, HIGH);
}
// down left
else if (state == 'z') {
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, HIGH);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, LOW);
}
// down right
else if (state == 'c') {
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, HIGH);
digitalWrite(motor2Pin2, LOW);
}
// backward
else if (state == 'd') {
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, HIGH);
digitalWrite(motor2Pin1, HIGH);
digitalWrite(motor2Pin2, LOW);
}
// turet right
else if (state == 'o') {
digitalWrite(right, HIGH);
digitalWrite(left, LOW);
}
// turet left
else if (state == 'p') {
digitalWrite(right, LOW);
digitalWrite(left, HIGH);
}
// turet up down
else if (state == 'k') {
digitalWrite(up, HIGH);
}
// fire
else if (state == 'f') {
digitalWrite(fire, HIGH);
}
// Stop
else {
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, LOW);
digitalWrite(up, LOW);
digitalWrite(fire, LOW);
digitalWrite(right, LOW);
digitalWrite(left, LOW);
noTone(13);
}
delay(100);
}


