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!


Squeeze Box

Project Members: 
Joshua Gomez

Description

Create a single artifact that incorporates both input and output. I made a musical squeeze box using a cardboard box. When you squeeze the sides of the box it outputs a musical tone. You can twist the knob at the end to change the pitch of the output noise (musical note).

Components Used

1 Resistors

1 Potentiometers 

1 Force Sensitive Resistor

1 Piezo Speaker

cardboard box and sponge foam 

Arduino Code

/*
 * Joshua Gomez - Lab 5
 *
 * This code is for a music box
 * By pressing the button a sound is emitted
 * The sound played is detremined by the value of the POT input
 */

int potPin = 0;    // select the input pin for the potentiometer
int fsrPin = 5;    // select the input pin for the FSR
int speakerPin = 11;// set the output pin for the piezo speaker

int potVal = 0;
int fsrVal = 0;

void setup() {
  pinMode(speakerPin, OUTPUT);
  beginSerial(9600);
  Serial.println("ready");
}

void loop() {
  fsrVal = analogRead(fsrPin);
  if(fsrVal>10)
  {
    potVal = analogRead(potPin) + 950;
    for( int i=0; i<200; i++)
    {
      digitalWrite(speakerPin, HIGH);
      delayMicroseconds(potVal);
      digitalWrite(speakerPin, LOW);
      delayMicroseconds(potVal);
    }
  }
  else
    digitalWrite(speakerPin, LOW);
}

 Item

Squeeze BoxSqueeze Box

Squeeze BoxSqueeze Box

Squeeze BoxSqueeze Box


Powered by Drupal - Design by Artinet