The Amazing Annoyatron

0 of 20 lessons complete (0%)

Curiosity Killer

In this project, you are going to be building a button that gives almost no satisfaction when pressed. It just beeps. And if you want it to beep again, you have to take your finger off and put it back on again.


Parts list

What you’ll need

Computer
Computer
Brain Board
Brain Board
Buzzer
Buzzer
USB Cable
USB Cable
Touch Sensor
Touch Sensor
Wires
3 x Wires

Step 1

Let’s build this

Curiosity Killer

This is the positive leg of the buzzer. It will have a ‘+’ over top and will also be longer than the other leg.

Don’t forget to plug the board into your computer with the supplied USB cable.

The touch sensor is like a button, except that you only have to touch it lightly.

Connections

Buzzer

The +LEG is the longer leg.

+ LEG11
– LEGGND

Touch Sensor

Use wires to join these.

SIG11
VCC5V
GNDGND

Step 2

Code some chaos

Don’t forget to select your port, like usual

Copy and paste the sample code

curiosity_killer.ino
int touchSensor = 3;
int buzzer = 11;
int beepLength = 50;

void setup() {
  pinMode(buzzer, OUTPUT);
  pinMode(touchSensor, INPUT);
}

void loop() {
  if(digitalRead(touchSensor)==HIGH) { 
    digitalWrite(buzzer, HIGH);
    delay(beepLength);
    digitalWrite(buzzer, LOW);
    delay(beepLength);
    while(digitalRead(touchSensor)==HIGH){
    }
   }
  else {
    digitalWrite(buzzer, LOW);
   }
}

Upload the code and test it out