Actually I'm working with the motor shield V2.3, but I have a problem tor run the DC motor. I'm suplying the shield with a 7,4V battery and i want to run a DC motor of 3-6V.
the servomotors runs perfectly but the Motors not. I don't know whats happening.
Motor shield v2.3
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_bill
- Posts: 88141
- Joined: Sat Feb 07, 2009 10:11 am
Re: Motor shield v2.3
Please post photos of the front and back of the shield and the electrical specifications for the motor you are using.
- adafruit_support_bill
- Posts: 88141
- Joined: Sat Feb 07, 2009 10:11 am
Re: Motor shield v2.3
Please post the electrical specifications for your motors - and show us how they are wired up.
Also post the code you are using to test.
Also post the code you are using to test.
- Albr
- Posts: 7
- Joined: Thu Oct 30, 2014 12:55 pm
Re: Motor shield v2.3
General specifications
Typical operating voltage: 3 V
Gear ratio options: 11.6, 18.0 :1
Free-run motor shaft speed @ 3V: 9400 rpm1
Free-run current @ 3V: 150 mA2
Stall current @ 3V: 2700 mA
Motor shaft stall torque @ 3V: 0.97 oz·in3
Arduino code:
#include <AFMotor.h>
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("tock");
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);
}
Typical operating voltage: 3 V
Gear ratio options: 11.6, 18.0 :1
Free-run motor shaft speed @ 3V: 9400 rpm1
Free-run current @ 3V: 150 mA2
Stall current @ 3V: 2700 mA
Motor shaft stall torque @ 3V: 0.97 oz·in3
Arduino code:
#include <AFMotor.h>
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("tock");
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);
}
- adafruit_support_bill
- Posts: 88141
- Joined: Sat Feb 07, 2009 10:11 am
Re: Motor shield v2.3
Code: Select all
#include <AFMotor.h>
https://github.com/adafruit/Adafruit_Mo ... V2_Library
- Albr
- Posts: 7
- Joined: Thu Oct 30, 2014 12:55 pm
Re: Motor shield v2.3
when I put this code:
the program says to me this:
sketch_nov08a.ino:3:45: error: utility/Adafruit_PWMServoDriver.h: No such file or directory
sketch_nov08a:6: error: 'Adafruit_MotorShield' does not name a type
sketch_nov08a:11: error: expected constructor, destructor, or type conversion before '*' token
sketch_nov08a.ino: In function 'void setup()':
sketch_nov08a:21: error: 'AFMS' was not declared in this scope
sketch_nov08a:25: error: 'myMotor' was not declared in this scope
sketch_nov08a:26: error: 'FORWARD' was not declared in this scope
sketch_nov08a:28: error: 'RELEASE' was not declared in this scope
sketch_nov08a.ino: In function 'void loop()':
sketch_nov08a:36: error: 'myMotor' was not declared in this scope
sketch_nov08a:36: error: 'FORWARD' was not declared in this scope
sketch_nov08a:48: error: 'BACKWARD' was not declared in this scope
sketch_nov08a:59: error: 'RELEASE' was not declared in this scope
Code: Select all
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"
// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x60);
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);
// Select which 'port' M1, M2, M3 or M4. In this case, M1
Adafruit_DCMotor *myMotor = AFMS.getMotor(1);
// You can also make another motor on port M2
//Adafruit_DCMotor *myOtherMotor = AFMS.getMotor(2);
int bluetoothRX= 0;
int bluetoothTX= 1;
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Adafruit Motorshield v2 - DC Motor test!");
AFMS.begin(); // create with the default frequency 1.6KHz
//AFMS.begin(1000); // OR with a different frequency, say 1KHz
// Set the speed to start, from 0 (off) to 255 (max speed)
myMotor->setSpeed(150);
myMotor->run(FORWARD);
// turn on motor
myMotor->run(RELEASE);
}
void loop() {
uint8_t i;
Serial.print("tick");
myMotor->run(FORWARD);
for (i=0; i<255; i++) {
myMotor->setSpeed(i);
delay(10);
}
for (i=255; i!=0; i--) {
myMotor->setSpeed(i);
delay(10);
}
Serial.print("tock");
myMotor->run(BACKWARD);
for (i=0; i<255; i++) {
myMotor->setSpeed(i);
delay(10);
}
for (i=255; i!=0; i--) {
myMotor->setSpeed(i);
delay(10);
}
Serial.print("tech");
myMotor->run(RELEASE);
delay(1000);
}
sketch_nov08a.ino:3:45: error: utility/Adafruit_PWMServoDriver.h: No such file or directory
sketch_nov08a:6: error: 'Adafruit_MotorShield' does not name a type
sketch_nov08a:11: error: expected constructor, destructor, or type conversion before '*' token
sketch_nov08a.ino: In function 'void setup()':
sketch_nov08a:21: error: 'AFMS' was not declared in this scope
sketch_nov08a:25: error: 'myMotor' was not declared in this scope
sketch_nov08a:26: error: 'FORWARD' was not declared in this scope
sketch_nov08a:28: error: 'RELEASE' was not declared in this scope
sketch_nov08a.ino: In function 'void loop()':
sketch_nov08a:36: error: 'myMotor' was not declared in this scope
sketch_nov08a:36: error: 'FORWARD' was not declared in this scope
sketch_nov08a:48: error: 'BACKWARD' was not declared in this scope
sketch_nov08a:59: error: 'RELEASE' was not declared in this scope
Last edited by adafruit_support_bill on Sat Nov 08, 2014 1:07 pm, edited 1 time in total.
Reason: please use the </> button when submitting code. press </>, then paste your code between the [code] [/code] tags.
Reason: please use the </> button when submitting code. press </>, then paste your code between the [code] [/code] tags.
- adafruit_support_bill
- Posts: 88141
- Joined: Sat Feb 07, 2009 10:11 am
Re: Motor shield v2.3
You have to install the complete library - including all sub-folders.sketch_nov08a.ino:3:45: error: utility/Adafruit_PWMServoDriver.h: No such file or directory
Follow the instructions here for installing libraries.
http://learn.adafruit.com/adafruit-all- ... nstall-use
- Albr
- Posts: 7
- Joined: Thu Oct 30, 2014 12:55 pm
Re: Motor shield v2.3
Sorry but now the computer doesn't recognize the bluetooth shield, and i don't touch the bluetooth for anything.
- Albr
- Posts: 7
- Joined: Thu Oct 30, 2014 12:55 pm
Re: Motor shield v2.3
Sorry but now the computer doesn't recognize the bluetooth shield, and i don't touch the bluetooth for anything.
- adafruit_support_bill
- Posts: 88141
- Joined: Sat Feb 07, 2009 10:11 am
Re: Motor shield v2.3
Since this is not related to the original topic, please start a new thread. Be sure to include important information like what boards you are using and what operating system you use on your computer.
Please be positive and constructive with your questions and comments.