Lab06: Hands of a Clock

Description:

Unfortunately, the wires I soldered to my DC motor snapped off and additionally got stuck in the breadboard; but, I’ve seriously considered certain applications that I was in the middle of developing. When the FSR has pressure applied to it, the DC motor spins more swiftly. So, as pressure is applied to the FSR, it is as though we are rushing forward through time (similar to Hermione’s time-turner pendant). Additionally, I considered this process to be similar to how an electric pencil sharpener works. When pressure is applied to the pencil sharpener, it knows to spin and sharpen your pencil.

Components Used:

  • 1 Arduino
  • 1 Resistor (1kΩ)
  • 1 Breadboard
  • 1 FSR potentiometer
  • 1 DC motor
  • 1 transistor
  • 1 diode

Code:

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

int potPin = A0; // 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 = 1024 - analogRead(potPin); // read the value from the sensor, between 0 - 1024, and then subtract from 1024
 Serial.println(val);
 analogWrite(motorPin, val/11); // analogWrite can be between 0-255
}



img_6316

Leave a Reply