Description:
For this assignment, the goal was to use the DC Motor to explore some kind of motion. I came up with Frodog, the pet frog/dog combination who wags his tail, and purrs every time he is petted. Basically he is the comination of all the good things about pets. He smiles, purrs, wags his tail and is very social and needy (wants to be petted).
The DC motor is hooked to a piece of pencil which is attached to it at an angle, so that it creates a wagging motion instead of circular motion. The pencil covered in green paper is the tail, the body is loofah, and the head is a stuffed smiling frog face. The FSR is mounted on his head.
The code was only modified to include the FSR input and I have included a delay so that the wagging doesnt seem to abrupt.
A video can be found here : http://instagram.com/p/fzL-xqEN_U/
Components:
1 Arduino
1 frog head loofah
1 FSR
1 1k resistor
1 Diode
1 Transitor
1 3V battery supply
Lots of wires
Code:
/* Frodog
* FSR input controls the motor
* modified version of AnalogInput
* by DojoDave <http://www.0j0.org>
* http://www.arduino.cc/en/Tutorial/AnalogInput
* Modified again by dave
*/
int FSRPin = 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(FSRPin); // read the value from the sensor, between 0 - 1024
Serial.println(val);
if(val==0){
analogWrite(motorPin, 150);
delay(2000);
}
else{
analogWrite(motorPin, 0);
}
}
- Login to post comments