Lab 6 - Kitty Mobiles

Submitted by seanchen on Tue, 03/12/2013 - 22:51

Description

I designed a baby mobiles-like toy for cats. The motor is connected to a stick, which has two toys on each side. User can control the speed with a potentiometer. The implementation was not hard. But to get it to work required some additional efforts. Since there were too many parts, I had to put them together so I can hold the breadboards, batteries, potentiometer, and motor in one hand. The 'user' testing was also pretty difficult. Our cat - Mimi - is a little old and very lazy. She usually doesn't bat any toys even right besides her. Fortunately, I was able to get a little result on the video.

http://youtu.be/8zax0ovD4SQ

 

Components

1 x Arduino UNO Board

 
1 x Potentiometer
 
1 x DC motor
 

Code

 

int potPin = 0;   // select the input pin for the potentiometer
int motorPin = 9; // 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
}
 
0
Your rating: None
Drupal theme by Kiwi Themes.