DESCRIPTION
The main focus of this lab was to combine input and output sensors into one artifact using things learned from previous lab assignments and homework assignments. I chose to work with a FSR as the primary input, and a red LED light and a piezo speaker as the primary output.
My first immediate thought was to do something with heartbeats. I thought of the red LED beating like heartbeats and having the piezo speaker chime in time with the heartbeats. I was then inspired to hook it up to a FSR to a pair of lips. The whole idea is to reflect the emotional aspect of love and the "first kiss". As someone's lips theoretically come closer and press into the lips, the LED light blinks faster and the piezo speaker chimes to the LED blink; this whole aspect representing the increased heartbeat and excitement when experiencing that moment.
Video: http://instagram.com/p/fhJHO0RyWg/
MATERIALS
1 - Arduino Uno
1 - Breadboard
1 - Red LED
1 - USB Cable
1 - 220 Ohm Resistor
1 - Force Sensitive Resistor
1 - Piezo Speaker
7 - Wires
A lot - Masking tape, duct tape, pink washi tape, coffee filter, black sharpie, paper cup, pink tissue paper, chopsticks, half of a sandwhich press, salsa lid
CODE
int sensorPin = 0; // select the input pin for the sensor
int speakerPin = 7; // piezo
int ledPin = 11; // select the output pin for the LED
int val = 0; // variable to store the value coming from the sensor
int delayValue = 10;
void setup() {
pinMode(speakerPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
val = 1023 - analogRead(sensorPin); // read the value from the sensor, 0-1023
val = (val - 750) / 4;
Serial.println(val); // writing the value to the PC via serial connection
analogWrite(ledPin, 255); // turn the LED on (HIGH is the voltage level)
int delayHigh = delayValue * (.5 * (val+1));
digitalWrite(speakerPin, HIGH);
delay(delayHigh); // wait for a second
analogWrite(ledPin, 0); // turn the LED off by making the voltage LOW
int delayLow = delayValue * (val+1);
digitalWrite(speakerPin, LOW);
delay(delayLow); // wait for a second
}
- Login to post comments