Wednesday, November 28, 2012

Nov 27 - More Final Project

So this week we've made a lot of progress with our project. We glued on the 3D printed feet, put together our hardware, taped the acrylic and board together to give us a consistent surface, and started working on the programming. Hardware wise, we're done. Now we just have to tackle the software.

So far, we only have the code we've worked with in Arduino. This basically just takes the input from the piezzos. Any time any of the buzzers give an output that is more than 10, four numbers (one for each buzzer) get printer in a line in the serial monitor.

Here's the bit of code we currently have:


const int sensorPin = 0;
const int ledPin = 13;
const int THRESHOLD = 100;

void setup()
{
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop()
{
  int inp0 = analogRead(A0);
  int inp1 = analogRead(A1);
  int inp2 = analogRead(A2);
  int inp3 = analogRead(A3);  
  
  if(inp0 > 10 || inp1 > 10 || inp2 > 10 || inp3 > 10) {
    Serial.println("Wave Detected!");
    while(inp0 > 10 || inp1 > 10 || inp2 > 10 || inp3 > 10){
      Serial.print(inp0);
      Serial.print(",");
      Serial.print(inp1);
      Serial.print(",");
      Serial.print(inp2);
      Serial.print(",");
      Serial.print(inp3);
      Serial.println();
      
      inp0 = analogRead(A0);
      inp1 = analogRead(A1);
      inp2 = analogRead(A2);
      inp3 = analogRead(A3);
      }
    Serial.println("Wave Ended!");
    }
}

The printing of Wave Detected and Wave Ended is simply a good visual for determining when there are vibrations and when there are not. 

Thursday we're going to start looking at how we are going to use Processing to create a visual display to go with our drum!

No comments:

Post a Comment