The Amazing Annoyatron

0 of 20 lessons complete (0%)

Definitely Not Music

You know what music is, right? Well, we can guarantee that this is NOT it. We don’t want to spoil the surprise, but this one’s really, really annoying.


Parts list

What you’ll need

Computer
Computer
Brain Board
Brain Board
Buzzer
Buzzer
USB Cable
USB Cable

Step 1

Let’s build this

Ticking Clock 2

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.

Connections

Buzzer

The +LEG is the longer leg.

+ LEG11
– LEGGND

Step 2

Code some chaos

Don’t forget to select your port, like usual

Copy and paste the sample code

definitely_not_music.ino
int buzzer = 11;

void setup() {
  // put your setup code here, to run once:
  pinMode(buzzer, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(buzzer, random(2));
  delay(1);
}

Upload the code and test it out


Step 3

Modify the madness

Fiddle with the noise

The code for this invention is short, but that’s a good thing. All the code does is randomly sets the buzzer to either off or on every 1 millisecond.

delay(1);

That’s what causes the racket you heard after you uploaded the code – it’s known as ‘white noise’.

Change the delay in line 11 to alter the sound of the noise. You can’t create a delay smaller than 1 millisecond, so you’ll have to try larger values.

delay(10);