Makeshift Doorbell with LED

Using a LilyPad Arduino with the LilyPad LED, pressure sensor, and Piezo, I made a make shift doorbell with a dimming light and buzzer. I could not find a fabric that would hold up well for the sensor, so I used paper instead. When the sensor is pressed, the volume of the Piezo increases, while the light dims.

Raynor/ Soft Switch

I made a switch to toggle different lights whenever the circuit was open or closed. When I closed the circuit, a blue light is illuminated. When the circuit is broken, the red light becomes illuminated.img_2413Here is the code for the project:

const int buttonPin = 3; // the number of the pushbutton pin
const int ledPin = 12; // the number of the LED pin
int buttonState = 0; // variable for reading the pushbutton status

void setup() {
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
pinMode(11, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
}

void loop() {
// read the state of the pushbutton value:
buttonState = digitalRead(buttonPin);

// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == LOW) {
// turn RED on:
digitalWrite(ledPin, HIGH);
digitalWrite(11, LOW);
} else {
// turn BLUE off:
digitalWrite(ledPin, LOW);
digitalWrite(11, HIGH);
}
}