Hyderabad , India
Offline
God Member
Karma: 5
Posts: 621
can't help not to think arduinaizing something !
|
 |
« Reply #30 on: December 10, 2010, 10:42:05 am » |
const int motor1Pin = 3; // H-bridge leg 1 (pin 2, 1A) const int motor2Pin = 4; // H-bridge leg 2 (pin 7, 2A) const int enablePin = 9; // H-bridge enable pin
void setup() { pinMode(motor1Pin, OUTPUT); pinMode(motor2Pin, OUTPUT); pinMode(enablePin, OUTPUT);
// set enablePin high so that motor can turn on: ADDED digitalWrite(enablePin, HIGH); } void loop() { digitalWrite(motor1Pin, HIGH); digitalWrite(motor2Pin, LOW); }
well thats not going to work if you dont have a delay because the pin is switched too fast to make any sense to the motor
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 22
Arduino rocks
|
 |
« Reply #31 on: December 10, 2010, 10:43:52 am » |
ok i understand. so with a delay(10000); to make it spin for 10 seconds is that code correct?
|
|
|
|
« Last Edit: December 10, 2010, 10:54:44 am by chizzad »
|
Logged
|
|
|
|
|
Hyderabad , India
Offline
God Member
Karma: 5
Posts: 621
can't help not to think arduinaizing something !
|
 |
« Reply #32 on: December 10, 2010, 12:47:37 pm » |
YES 
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 22
Arduino rocks
|
 |
« Reply #33 on: December 10, 2010, 01:26:35 pm » |
ok great. now i know my code works. now all i have to do is trouble shoot my connections... i wish i had an idea of where to begin..
i have already went two completely different ways. the first schematic and now im currently using the second. (minus the switch)
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 22
Arduino rocks
|
 |
« Reply #34 on: December 13, 2010, 10:57:55 am » |
ok guys. so since with the help of newbie and a bunch of you ive finally figured out simple code that should make my motor spin the wheels. i need to figure out why it is not. so now i am on to my wiring. im using this schematic  what is crossed out in green i didnt use and i labeled and put in what i added. also im not using a 9v im using a 4 battery pack of AA batteries. if anyone sees anything that i messed up or a better way to go about please post or message me. thanks a lot.
|
|
|
|
« Last Edit: December 13, 2010, 10:59:58 am by chizzad »
|
Logged
|
|
|
|
|
Hyderabad , India
Offline
God Member
Karma: 5
Posts: 621
can't help not to think arduinaizing something !
|
 |
« Reply #35 on: December 14, 2010, 06:36:00 am » |
WEll you did wire up things corectly And you Were right you didnt need that ground Extra And IS it Working 
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 22
Arduino rocks
|
 |
« Reply #36 on: December 14, 2010, 10:30:09 am » |
still not running. im at a lost considering my code and my wiring should both work. with other code i was trying i also made the led blink to see if the code was working at all and it was. i have no idea what to do as of right now. ive changed my wiring and coding twice with no success.
EDIT: im also going to get rid of the extra ground wire along with the two black wires to the left of it in the schematic because that side doesnt need ground because im not using it.
SECOND EDIT: im going to try a few things that will most likely not work (hard to be positive right now) 1. changed to a 9v 2. also im going to try to add simple LED code to see if thats getting sent to the board and being processed.
|
|
|
|
« Last Edit: December 14, 2010, 10:48:58 am by chizzad »
|
Logged
|
|
|
|
|
Hyderabad , India
Offline
God Member
Karma: 5
Posts: 621
can't help not to think arduinaizing something !
|
 |
« Reply #37 on: December 14, 2010, 10:46:16 am » |
well where is your code ? abnd i just notice that your post is in the exhibition forum ;D
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 22
Arduino rocks
|
 |
« Reply #38 on: December 14, 2010, 10:54:27 am » |
hah sorry when i first made my account i just kind of came on looked quickly and made on. if a mod wants to move it that would be great. i just now wrote up this code which the led is blinking but no motor movement.
#define m1p1 3 //motor one pin one #define m1p2 4 //motor one pin two const int ledPin = 13; void setup() { pinMode (m1p1,OUTPUT); pinMode (m1p2,OUTPUT); pinMode(ledPin, OUTPUT); blink(ledPin, 20, 100); } void loop() { digitalWrite(m1p1,HIGH); digitalWrite(m1p2,LOW); // drive motors forward set delay delay(10000); //now drive motors reverse both digitalWrite(m1p1,LOW); digitalWrite(m1p2,HIGH); delay(10000); }
void blink(int whatPin, int howManyTimes, int milliSecs) { int i = 0; for ( i = 0; i < howManyTimes; i++) { digitalWrite(whatPin, HIGH); delay(milliSecs/2); digitalWrite(whatPin, LOW); delay(milliSecs/2); } }
|
|
|
|
|
Logged
|
|
|
|
|
Hyderabad , India
Offline
God Member
Karma: 5
Posts: 621
can't help not to think arduinaizing something !
|
 |
« Reply #39 on: December 14, 2010, 11:03:35 am » |
Hmmm well but i see you use a enable pin in your schematic i guess pin 9 You need to put it high at all time to run the motors ! ( i didnt read the entire code )
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 30
Arduino rocks
|
 |
« Reply #40 on: December 14, 2010, 02:56:35 pm » |
Hi, I don't know if this will help you but have a look anyway http://letsmakerobots.com/node/2074Also while you're there have a look at some of the projects, there are a lot of ideas similar to yours and the community is really helpful 
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 22
Arduino rocks
|
 |
« Reply #41 on: December 15, 2010, 08:29:36 am » |
i was planning on trying to bring in an enable pin the other day but i thought that had something to do with the switch and knowing when it was on. are you looking at the schematic that i edited with the green Xs? because it shows the switch crossed out. otherwise i dont see anything around pin 9 i will but an enablePin(HIGH) im my program a little later this morning and see how things go.
thanks again newbie for all the help.
|
|
|
|
|
Logged
|
|
|
|
|
Hyderabad , India
Offline
God Member
Karma: 5
Posts: 621
can't help not to think arduinaizing something !
|
 |
« Reply #42 on: December 15, 2010, 11:17:09 am » |
are you looking at the schematic that i edited with the green Xs? Yeah ! dont you see a blue colour wire goint from the first pin on l293 d from the right ? :-? :-?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 22
Arduino rocks
|
 |
« Reply #43 on: December 15, 2010, 11:05:51 pm » |
ok so once again i went a completely different way and FINALLY success. i used the full schematic and didnt eliminate the switch and altered some code up and everything is working as of now.
now its time to start the real work.
|
|
|
|
|
Logged
|
|
|
|
|
Hyderabad , India
Offline
God Member
Karma: 5
Posts: 621
can't help not to think arduinaizing something !
|
 |
« Reply #44 on: December 16, 2010, 02:44:21 am » |
FINALLY success............working as of now now its time to start the real work this time post in the interfacing forum 
|
|
|
|
|
Logged
|
|
|
|
|
|