hi guys!i have my arduino and the motor shield. the robot is in picture:
The problem is: when i start the two motors, they go for a few moments and then they block, but i dont' know why. they should go costantly. help plz:)
hi guys!i have my arduino and the motor shield. the robot is in picture:
The problem is: when i start the two motors, they go for a few moments and then they block, but i dont' know why. they should go costantly. help plz:)
What awesome tracks subvert gravity?
Quick question. Does your arduino reset? If that is not the case then I would imagine we will need some more information. It may be something as simple as your code doesn’t do what you think it should be doing.
Little more info
This is the code: #include
This is the code:
#include <AFMotor.h>
AF_DCMotor motor2(2, MOTOR12_64KHZ);
AF_DCMotor motor1(1, MOTOR12_64KHZ);
char message=0;
int FOT1 = 5;
int FOT2 = 4;
// this vars will be used in the loop function
int FOTVal1 = 0;
int FOTVal2 = 0;
int DiffVal=0;
void setup(){
Serial.begin(9600);
delay(500);
motor1.setSpeed(200);
motor2.setSpeed(200);
}
void loop(){
FOTVal1 = analogRead(FOT1);
FOTVal2 = analogRead(FOT2);
DiffVal=FOTVal1-FOTVal2;
// print LDR values into the console
Serial.print(“Differenza val”);
Serial.print(DiffVal);
if (DiffVal<=75){
motor1.run(FORWARD);
motor2.run(FORWARD);
}else
if (FOTVal1<FOTVal2){
motor1.run(FORWARD);
motor2.setSpeed(100);
motor2.run(FORWARD);
}else
if (FOTVal2<FOTVal1){
motor2.run(FORWARD);
motor1.setSpeed(100);
motor1.run(FORWARD);
}
I think the problem is the external power supply for the motor shield. What battery i should use? i need to supply the small DC motors of the tamiya twin motor gearbox.
I think the problem is the
I think the problem is the power supply for the shield. i need to supply two small DC motors of the tamiya twin motor gearbox. what kind of battery i have to use?
I should add
I am guessing about the need for a second supply --You have not yet told us what you are using now.
for the motor shield supply
for the motor shield supply i used a 9v battery but the motors seem to go very slow. maybe the battery is spoiled?
thanks i would try it:)
thanks i would try it:)
There is your problem
The 9v battery can not supply the current you need. Try 4-6 AA’s instead.
Thanks a lot guys! it works:)
Thanks a lot guys! it works:)
Thi is strange: when the
Thi is strange: when the robot goes straight the motors don’t block; but when i command him to go backward the motors stop after one second.
this is the situation:
this is the situation: