DC motor does not work

Our weekly LIVE video chat. Every Wednesday at 8pm ET!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
sazmi
 
Posts: 5
Joined: Thu Jan 22, 2015 5:38 am

DC motor does not work

Post by sazmi »

Code: Select all

/* 
This is a test sketch for the Adafruit assembled Motor Shield for Arduino v2
It won't work with v1.x motor shields! Only for the v2's with built in PWM
control

For use with the Adafruit Motor Shield v2 
---->	http://www.adafruit.com/products/1438
*/

#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(); 
// 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);

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);
  myMotor->setSpeed(200);
  myMotor->run(FORWARD);
  // turn on motor
 // myMotor->run(RELEASE);
  
  
  delay(1000);
}


This code does not make the DC motor run on adafruit motor shield but the DC motor works independently.

Need suggestions.
Attachments
20150122_124754.jpg
20150122_124754.jpg (619.17 KiB) Viewed 728 times
20150122_124754.jpg
20150122_124754.jpg (619.17 KiB) Viewed 728 times
20150122_124754.jpg
20150122_124754.jpg (619.17 KiB) Viewed 729 times
Last edited by Franklin97355 on Thu Jan 22, 2015 12:49 pm, edited 1 time in total.
Reason: Added missing [code] tags

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: DC motor does not work

Post by adafruit_support_rick »

You haven't soldered any of the header pins on the shield. The pins won't make an electrical connection without solder.
https://learn.adafruit.com/adafruit-gui ... ring/tools

Locked
Please be positive and constructive with your questions and comments.

Return to “Ask an Engineer! VIDEO CHAT (closed)”