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:
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.
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.
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:
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.
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.