Output: DC motors

Posted by dperry

dperry's picture

Description

This assignment explores motion output.  I hooked up the motor to a clip and attached it to a toy figure to allow it to vibrate and move. I was trying to get it to walk forward but the effect was more a bobble backward.

Components Used

  • Arduino
  • Breadboard
  • wires
  • external battery
  • 1K resistor
  • DC motor
  • Diode
  • Transistor
  • paper clip
  • toy porcupine
  • tape
  • glue

Arduino Code

/*
 * one pot fades one motor
 * modified version of AnalogInput
 * by DojoDave <http://www.0j0.org>
 * Modified again by dave
 */

int potPin = 0;   // select the input pin for the potentiometer
int motorPin = 10; // select the pin for the Motor
int val = 0;      // variable to store the value coming from the sensor
void setup() {
  Serial.begin(9600);
}
void loop() {
  val = analogRead(potPin);    // read the value from the sensor, between 0 - 1024
  Serial.println(val);
  analogWrite(motorPin, val/4); // analogWrite can be between 0-255
}

Video Link


http://www.youtube.com/watch?v=y1d0ZizbM-A

0
Your rating: None
Tags: