Go Down

Topic: Help with determining issue (Read 57 times) previous topic - next topic

Hello All, I recieved this kit recently.  http://www.amazon.com/dp/B00D9NPP1E/ref=wl_it_dp_o_pC_nS_ttl?_encoding=UTF8&colid=39XD52ER0XKN5&coliid=IWKETGAWJHQ86&psc=1

It includes the sunfounder MEGA 2560.  I've not had any issues with the products up till now.  I'm on project 7 for the DC motor.  I have everything connected correctly I believe.  When I connect a multimeter to ground and to one of the 2 output wires I get a flucuation between .2 and .5 volts however my motor does not spin.  Is this due to a bad motor or is there something else I need to check? 

So I've determined that the motor is not dead but I'm guessing something is wrong with my code and sunfounder website is down for the moment. 

Here is my current code using from there CD.  Am I missing something here pretty sure i'm missing how to set speed

/***************************************/
const int motorIn1 = 9;  //attach to one of the pin of the motor
const int motorIn2 = 10;  //attach to another pin of the motor
/***************************************/
void setup()
{
  pinMode(motorIn1,OUTPUT);  //initialize the motorIn1 pin as output
  pinMode(motorIn2,OUTPUT);  //initialize the motorIn2 pin as output
}
/****************************************/
void loop()
{
  clockwise(200);  //rotate clockwise
  delay(1000);  //wait for a second
  counterclockwise(200);  //rotate counterclockwise
  delay(1000);  //wait for a second
}
/****************************************/
//The function to drive motor rotate clockwise
void clockwise(int Speed)
{
  analogWrite(motorIn1,Speed);  //set the speed of motor
  analogWrite(motorIn2,0);  //stop the motorIn2 pin of motor
}
//The function to drive motor rotate counterclockwise
void counterclockwise(int Speed)
{
  analogWrite(motorIn1,0);  //stop the motorIn1 pin of motor
  analogWrite(motorIn2,Speed);  //set the speed of motor
}
/****************************************/

So after a lot more googling it seems that this code is not for the diagram in the book.  The video and code are for controlling the motor and using just the L239D chip but yet in the book they give you a diagram and schematic for a circuit using optocouplers.  Sorry!

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy