S
S
Sergey2015-07-10 22:04:16
Arduino
Sergey, 2015-07-10 22:04:16

Motor shield motors not working?

I would be grateful if you could help a newbie understand.
Tamiya Twin-Motor Gearbox motors refuse to work. When power is applied directly to them, they work. But when connecting the motors through the motor shield and filling in the test sketch, nothing happens (does not work either powered by a PC or via batteries). The compiler does not swear, the arduinin itself is working, the shield too (the power light is on when the source is connected) I
use 4 AA batteries as a power source.
I used this code as a test sketch:
#include
AF_DCMotor motor(4);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Motor test!");
// turn on motor
motor.setSpeed(200);
motor run(RELEASE);
}
void loop() {
uint8_t i;
Serial print("tick");
motor run(FORWARD);
for (i=0; i<255; i++) {
motor.setSpeed(i);
delay(10);
}
for (i=255; i!=0; i--) {
motor.setSpeed(i);
delay(10);
}
Serial.print("current");
motor run(BACKWARD);
for (i=0; i<255; i++) {
motor.setSpeed(i);
delay(10);
}
for (i=255; i!=0; i--) {
motor.setSpeed(i);
delay(10);
}
Serial.print("tech");
motor run(RELEASE);
delay(1000);
}
motors connected to port 4

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Gusev, 2015-07-10
@EternalEnvy

If they work with direct power, then this is still a problem with the shield.
The presence of a power indication does not mean that the shield is working/correctly programmed.
What is a motor control shield?
Try like this :)
590e068e2bf5409aade482a1b1c92069.jpg

S
Sergey, 2015-07-10
@EternalEnvy

This one
f46a8c1e34d04eb1b0b1160a2a0976ef.JPG

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question