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.
Step 1
Let’s build this!

This is the positive leg of the buzzer. It will have a ‘+’ sign on top of it and will also be longer than the other leg.
Don’t forget to plug the board into your computer with the included 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.
SIG~3
VCC5V
GNDGND
Step 2
Code some chaos!
Don’t forget to select your port, like ususal
Copy and paste the sample code
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);
}
}