Go Down

Topic: How to spin motor backwards and where to plug it ? (Read 1 time) previous topic - next topic

adrianTNT

With this code I am able to make motors 1,3,4 to work but the #2 doesn't move at all. Maybe I burned something when I tested the pins to use (weeks ago)  :smiley-red:.
Is there some part on the board that I could check/replace? Anything else that might cause M2 not to work when 1,3,4 work?
I used the code below and just edited this number: "AF_DCMotor motor(1"
Thank you.

Code: [Select]
#include <AFMotor.h>

AF_DCMotor motor(1, MOTOR12_1KHZ); // create motor #1, 64KHz pwm

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Motor test!");
 
  motor.setSpeed(200);     // set the speed to 200/255
}

void loop() {
  Serial.print("tick");
 
  motor.run(FORWARD);      // turn it on going forward
  delay(1000);

  Serial.print("tock");
  motor.run(BACKWARD);     // the other way
  delay(1000);
 
  Serial.print("tack");
  motor.run(RELEASE);      // stopped
  delay(1000);
}


johnwasser

If the M2 terminals don't work it is likely the L293D chip at that end of the board is fried.  It's in a socket so it won't be hard to replace.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

kkuula

You can determine faulty L293D chip by replacing it between other channel and if only chip itself is faulty then channel 2 should work with chip taken other working channel.

adrianTNT

Yes, I think most probably I burned one of the chips. Yesterday I stopped playing with it for a while, I will test that soon.
Thanks for the suggestions.

Go Up