# Theory and Practice of Tangible User Interfaces

### Announcements

November 24, 2007
Reading for November 27th, are now posted. Enjoy!

October 2, 2007
To upload your thoughtless acts, create a new assignment page like any other lab. You'll see "Thoughtless Acts" listed as one of the assignment options.

May 24, 2008
This site has been archived and is no longer editable. Stay tuned for the next version, coming in the fall!

# Morse Code/Mini Drum

Project Members:
Kathleen Lu

### Description

I hooked up a FSR to the DC motor along with a crochet hook for what ultimately became a morse code writer/mini drum. I do think it's neat that the FSR is really responsive and the code varies the pulse. The rubber band keeps the hook in place or else it'd "crawl" away.

My original "automated crochet" didn't quite pan out. Maybe another time when I figure out how to make a crank lever.

### Materials Used:

DC Motor

Crochet Hook

Rubber Band

FSR

Small plastic disc

### Arduino Code:

`/* http://itp.nyu.edu/physcomp/Labs/Servo  Servo control from an analog input The minimum (minPulse) and maxiumum (maxPuluse) values will be different depending on your specific servo motor. Ideally, it should be between 1 and 2 milliseconds, but in practice, 0.5 - 2.5 milliseconds works well for me. Try different values to see what numbers are best for you. This program uses the millis() function to keep track of when the servo was  last pulsed.  millis() produces an overflow error (i.e. generates a number that's too big to fit in a long variable) after about 5 days. if you're making a program that has to run for more than 5 days, you may need to  account for this. by Tom Igoe additions by Carlyn Maw Created 28 Jan. 2006 Updated 7 Jun. 2006 */int servoPin = 2;     // Control pin for servo motorint minPulse = 500;   // Minimum servo positionint maxPulse = 2500;  // Maximum servo positionint pulse = 0;        // Amount to pulse the servolong lastPulse = 0;    // the time in milliseconds of the last pulseint refreshTime = 20; // the time needed in between pulsesint analogValue = 0;  // the value returned from the analog sensorint analogPin = 0;    // the analog pin that the sensor's onvoid setup() {  pinMode(servoPin, OUTPUT);  // Set servo pin as an output pin  pulse = minPulse;           // Set the motor position value to the minimum  Serial.begin(9600);}void loop() {  analogValue = analogRead(analogPin);      // read the analog input  pulse = (analogValue * 19) / 10 + minPulse;    // convert the analog value                                            // to a range between minPulse                                            // and maxPulse.   // pulse the servo again if rhe refresh time (20 ms) have passed:  if (millis() - lastPulse >= refreshTime) {    digitalWrite(servoPin, HIGH);   // Turn the motor on    delayMicroseconds(pulse);       // Length of the pulse sets the motor position    digitalWrite(servoPin, LOW);    // Turn the motor off    lastPulse = millis();           // save the time of the last pulse  }}`

Image 2Image 1