Stupid Bend Trick

http://youtu.be/camRmJVXcl0

I added a flex sensor into the analog input, and then outputted it into a super annoying little speaker. Ugh shut it up.

 

int speakerPin = 7;
int bend = A0;

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

void loop(){
  int bendVal = analogRead(bend);
  int speakerVal = bendVal * 5;
  Serial.println((String) bendVal + " -> " + (String) speakerVal);
  tone(speakerPin, speakerVal);
}

 

Leave a Reply