Understanding IC for car Project

Hello guy,
This is my first Post so if I make any mistake sorry in advance.
I'm trying to make a mini robot for my first project the frame I bought from China(attached rc.jpg)
and it came with two DC motor. So i started to research for the configuration for this motors and decide to do some trial and error first before going to my robot... i have an arduino UNO board and was trying to use a on/off/on switch(attached pin.jpg) to see if the IC is working as i was expecting(if i turn in one configuration it the motor rotates clockwise and if turn to other configuration it goes counter-clock).. but something went wrong and i wanted to know if someone could help me. I will attach the circuit schematics(attachment board1.jpg) and the code:

 int read1=0;
 int read2=0;
 const int enable=9;
 const int controlPin1 = 2;
 const int controlPin2 = 3;
void setup(){
  Serial.begin(9600);
  pinMode(read1,INPUT);
  pinMode(read2,INPUT);
  pinMode(controlPin1,OUTPUT);
  pinMode(controlPin2,OUTPUT);
  digitalWrite(enable,OUTPUT);
  
}
void loop(){
  read1=digitalRead(7);
  read2=digitalRead(6);
  
  if(read1==HIGH){
     digitalWrite(enable,HIGH);
     digitalWrite(controlPin2,HIGH);
    digitalWrite(controlPin1,LOW);
     Serial.print(read1);
     Serial.print(read2);
  }
  if(read2==HIGH){
     digitalWrite(enable,HIGH);
    digitalWrite(controlPin1,HIGH);
    digitalWrite(controlPin2,LOW);
     Serial.print(read1);
  Serial.print(read2);
  }
  //else{
  //  digitalWrite(13,LOW);
    //digitalWrite(12,LOW);
  //}
 
  delay(100);
}

The Serial.print is there just for me to know if my switch was working.
Thanks in Advance .

pin.jpg

rc.jpg

ArtAnzy:
the IC

What IC is it?

but something went wrong

What went wrong?

We'll help if we can but give us more to work with...

If that's a 293 you need 5V on pin 16 to power the chip

JimboZA:
What IC is it?

What went wrong?

We'll help if we can but give us more to work with...

Sorry I forgot to mention the IC is the one that come with started kit L293DNE.
What is happening is when i flip the switch the Motor does not turn on. I inserted the Serial print to see if the switches are functioning... I didn't quiet get it the concept of the enable pin on the IC...I am presuming that is the mistake i have made in my code.

JimboZA:
If that's a 293 you need 5V on pin 16 to power the chip

I Apologize for the mistake in the diagram i didn't put the connection between the 16 pin and the 5V but in my real project i have connect the 16 pin to the 5Vpower.(attached board2.jpg fixed)

Thanks for the quick reply and sorry for the rookies mistakes.

What is the motor supply voltage. The 293 will drop at least 2V. If the battery is 3V only 1V gets to the motor.

groundfungus:
What is the motor supply voltage. The 293 will drop at least 2V. If the battery is 3V only 1V gets to the motor.

The motor supply is a 9V batteries(sorry i didn't realise that i could change the batteries in the program i'm using to do the sketch)

You might have one of those breadboards where the power rails are broken in the middle in which case you will need to bridge the gap or rearrange the wiring.

Check with your meter at the IC to see if there's 9v across pin 8 and 4 or 5.

breadboard2.jpg

JimboZA:
You might have one of those breadboards where the power rails are broken in the middle in which case you will need to bridge the gap or rearrange the wiring.

Check with your meter at the IC to see if there's 9v across pin 8 and 4 or 5.

Ok i checked with my meter and is 9V between pin 8 and 5

Ok guys I got it my code was wrong ;D .. I forgot to set the pinMode of the enable pin that's why the motor wasn't working.
Thanks for the Help everyone!!

Guys I moved to my main project now the mini robot and I think i have made the right connections I don`t know why is not working I attached the board layout and the code is right here:

 int read1=0;
 int read2=0;
 const int enable1=9;
 const int enable2=10;
 const int controlPin1 = 2; //input1 pin2
 const int controlPin2 = 3; //input2 pin7
 const int controlPin3 = 4; //input3 pin10
 const int controlPin4 = 5; //input4 pin15
void setup(){
  Serial.begin(9600);
  pinMode(read1,INPUT);
  pinMode(read2,INPUT);
  pinMode(controlPin1,OUTPUT);
  pinMode(controlPin2,OUTPUT);
  pinMode(controlPin3,OUTPUT);
  pinMode(controlPin4,OUTPUT);
  pinMode(enable1,OUTPUT);
  pinMode(enable2,OUTPUT);
  
}
void loop(){
  read1=digitalRead(7);
  read2=digitalRead(6);
  digitalWrite(enable1,LOW);
  digitalWrite(enable2,LOW);
  if(read1==HIGH){
     digitalWrite(enable1,HIGH);
     digitalWrite(enable2,HIGH);
     digitalWrite(controlPin1,LOW);
     digitalWrite(controlPin2,HIGH);
     digitalWrite(controlPin3,LOW);
     digitalWrite(controlPin4,HIGH);
     Serial.print(read1);
     Serial.print(read2);
     Serial.print(enable1);
     Serial.print(enable2);
  }
  if(read2==HIGH){
     digitalWrite(enable1,HIGH);
     digitalWrite(enable2,HIGH);
    digitalWrite(controlPin1,HIGH);
    digitalWrite(controlPin2,LOW);
    digitalWrite(controlPin3,HIGH);
     digitalWrite(controlPin4,LOW);
     Serial.print(read1);
     Serial.print(read2);
     Serial.print(enable1);
     Serial.print(enable2);
  }
 
  delay(1000);
}

I put the Serial to see if they are receiving energy and the switch is working and the print of the serial is 01910... I don't know if it is read1=0,read2=1, enable1=9,enable2=10.
If anyone can help me thanks in advance

enable1 and enable2 are not the "contents" of the pin, as in high or low, they are the pin numbers: you set them to be 9 and 10 at the top of the sketch. There's no point trying to print the pin state: you just set them your self as high anyway. It's the input pins you need to read and print, since those are your switch, and you did that. So yep 01 means one is 0 and the other is 1.

Make your Serial.print into Serial.println which will give you new lines to make it easier to decipher.

Those Fritzing's are impossible to read, you should download something like Express and make proper schamatics. Express is free and quick to learn.

If it's not working... explain what's wrong.

JimboZA:
enable1 and enable2 are not the "contents" of the pin, as in high or low, they are the pin numbers: you set them to be 9 and 10 at the top of the sketch. There's no point trying to print the pin state: you just set them your self as high anyway. It's the input pins you need to read and print, since those are your switch, and you did that. So yep 01 means one is 0 and the other is 1.

Make your Serial.print into Serial.println which will give you new lines to make it easier to decipher.

Those Fritzing's are impossible to read, you should download something like Express and make proper schamatics. Express is free and quick to learn.

If it's not working... explain what's wrong.

First of all thanks for the Help JimboZA, I ill try to use the program that you advised.
What is not working are the motors when I flip the switch nothing happens... The first thing that came into my mind was that the motor wasn't receiving enough power, so I hook both of them directly at the power source(9V Batteries) and it was working ok... If you have any suggestion to my narrow down my problem I be glad to try it out.