Josef Ayala-Wake-O-Lantern!

Description: This pumpkin was a simple exercise in implementing a circuit inside of an enclosure. It’s immediate purpose is to act as a sort of alarm, or sound and light signal for anyone aware of its use. The overall interaction of this pumpkin comes from changing its vertically. When the pumpkin is upright it’s quiet and when it is placed upside down it emits a sound. It’s interaction is based on both visual (seeing me sleep) and hearing the alarm (flipping the pumpkin over).

Wake-O-Lantern uses:
-Tilt Sensor (laced with cardboard to prevent short circuit).
-Blue/Red LED (laced with cardboard to prevent short circuit).
-8 Ohm Speaker (for positioning purposes, it was hot glued).

PComp Pumpkin-Midterm-A from Josef Ayala on Vimeo.

Interaction video can be seen here:

(Sorry, still waiting for the upload!)

// constants won’t change. They’re used here to
// set pin numbers:

const int buttonPin = 4;     // the number of the pushbutton pin
const int ledPin5 = 5;      // the number of the LED pin
const int ledPin9 = 9;
const int speaker = 8;
int timer = 100;

// variables will change:
int buttonState = 0;         // variable for reading the pushbutton status

void setup() {
// initialize the LED pin as an output:
pinMode(ledPin5, OUTPUT);
pinMode(ledPin9, OUTPUT);
pinMode(speaker, 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 LED off:
delay (1000);
digitalWrite(ledPin5, HIGH);
digitalWrite(ledPin9, LOW);
else {
// turn LED off:
delay (1000);
digitalWrite(ledPin9, HIGH);
digitalWrite(ledPin5, LOW);