Thanks for the help.
I didn't know that there were screws along the sides. I was plugging the wires from my DC motor into those holes next to each screw. So, I'm suppose to put a wire into the holes where the screws are and then screw the screw back into the hole while the wire is still in there to use that terminal? I could somehow touch the wire to the screw too such as soldering, right?
As for the servo motor, I connected it as shown in the picture I uploaded and ran the code I posted below.
I have the Arduino plugged into USB from my computer and nothing happens. I installed the Adafruit Motor Shield library and this code is from the "Motor Party" example. What am I doing wrong? I have a 9V battery I could connect to either the Arduino or Motor Shield, will this help?
[/// Adafruit Motor shield library
// copyright Adafruit Industries LLC, 2009
// this code is public domain, enjoy!
#include <AFMotor.h>
#include <Servo.h>
// DC motor on M2
AF_DCMotor motor(2);
// DC hobby servo
Servo servo1;
// Stepper motor on M3+M4 48 steps per revolution
AF_Stepper stepper(48, 2);
void setup() {
Serial.begin(9600); // set up Serial library at 9600 bps
Serial.println("Motor party!");
// turn on servo
servo1.attach(9);
// turn on motor #2
motor.setSpeed(200);
motor.run(RELEASE);
}
int i;
// Test the DC motor, stepper and servo ALL AT ONCE!
void loop() {
motor.run(FORWARD);
for (i=0; i<255; i++) {
servo1.write(i);
motor.setSpeed(i);
stepper.step(1, FORWARD, INTERLEAVE);
delay(3);
}
for (i=255; i!=0; i--) {
servo1.write(i-255);
motor.setSpeed(i);
stepper.step(1, BACKWARD, INTERLEAVE);
delay(3);
}
motor.run(BACKWARD);
for (i=0; i<255; i++) {
servo1.write(i);
motor.setSpeed(i);
delay(3);
stepper.step(1, FORWARD, DOUBLE);
}
for (i=255; i!=0; i--) {
servo1.write(i-255);
motor.setSpeed(i);
stepper.step(1, BACKWARD, DOUBLE);
delay(3);
}
}]
