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!


Revision of A Box from Wed, 11/07/2007 - 21:31

Project Members: 
Aylin Selcukoglu
Jess Kline
kartikeya
n8agrin
Travis Pinnick

Description

It's a box! But it's no ordinary box - it's a drum box.

It's collaborative, like a drum circle, portable, and customizable (i.e. you can upload any beat that you want to map to a drum pad and change it around at will).

Components

A large purple tub (not quite a box - but box sounded better than tub), 4 red leds, 4 fsrs, 4 cardboard circles, bubble wrap, breadboard, resistors, and a lot of wire

Arduino Code

/*
 * interface to detect when FSR's have been hit
 * in response make LEDs blink and tell Processing that the FSR was pressed
 */

// analog pin settings
int fsrPin1 = 5;               // FSRs connected to analog pins 5 - 2   
int fsrPin2 = 4;     
int fsrPin3 = 3;  
int fsrPin4 = 2;

// digital pin settings
int ledPin1 = 11;              // LEDs connected to digital pins 13 - 10
int ledPin2 = 10;
int ledPin3 = 9;
int ledPin4 = 8;

// values
int val1 = 0;                  // variables to store input from FSRs
int val2 = 0;
int val3 = 0;
int val4 = 0;

void setup() {
  pinMode(ledPin1, OUTPUT);    // set digital pins as output
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode(ledPin4, OUTPUT);
  
  //TEST
  /*digitalWrite(ledPin1, HIGH); 
  digitalWrite(ledPin2, HIGH); 
  digitalWrite(ledPin3, HIGH); 
  digitalWrite(ledPin4, HIGH);*/ 
  
  Serial.begin(9600);          // open serial communication
  //Serial.print("go");        // tell Processing Arduino is ready
}
void loop() {
  
  val1 = analogRead(fsrPin1);   // read the input pins (FSR's)
  val2 = analogRead(fsrPin2);   
  val3 = analogRead(fsrPin3);   
  val4 = analogRead(fsrPin4);   
  
  //if val above threshold
  if(val1 >= 100) {
    Serial.println("a");          // FSR A went off, send to Processing
    //Serial.println(val1);     // send value to Processing
    
    digitalWrite(ledPin1, HIGH);    // turn LED on
    delay(100);
    digitalWrite(ledPin1, LOW);      // turn LED off
  }
    
  //if val above threshold
  if(val2 >= 100) {
    Serial.println("b");          // FSR B went off, send to Processing
    //Serial.println(val2);     // send value to Processing
    
    digitalWrite(ledPin2, HIGH);    // turn LED on
    delay(100);
    digitalWrite(ledPin2, LOW);      // turn LED off
  }
    
  //if val above threshold
  if(val3 >= 100) {
    Serial.println("c");          // FSR C went off, send to Processing
    //Serial.println(val3);     // send value to Processing
    
    digitalWrite(ledPin3, HIGH);    // turn LED on
    delay(100);
    digitalWrite(ledPin3, LOW);      // turn LED off
  }
    
  //if val above threshold
  if(val4 >= 100) {
    Serial.println("d");          // FSR D went off, send to Processing
    //Serial.println(val4);     // send value to Processing
    
    digitalWrite(ledPin4, HIGH);    // turn LED on
    delay(100);
    digitalWrite(ledPin4, LOW);      // turn LED off
  }

Processing Code 

Pictures


Powered by Drupal - Design by Artinet