01.
Everyone loves arcade games. In this project, you’ll be building and programming one that will have your family and friends frustrated for hours. Someone too good at it? You can tweak a few lines of code and make the Impossible Game even more impossible.
How does the game work? An RGB (colour-changing) LED will cycle through three different colours at a very fast pace. To win the game, you need to press the touch sensor when the LED is displaying the colour red. Be warned: it’s not as easy as it sounds.
What you’ll need
As always, we’ll be using the Brain Board and a USB cable to connect it to your computer. You will also need a Colour LED – this is the one with the clear top and four ‘legs’, a Touch Sensor and 7 Wires.
Brain Board
Colour LED
Touch Sensor
Assorted Wires
How to connect the parts
To connect your buzzer, slide its pins into the Brain Board as shown – the positive leg should go in PIN 11 and the negative leg should go in GND. For the RGB LED, use the diagram below to connect the pins correctly to the board.
When wiring up your RGB LED, you can use different coloured wires to those in the diagram below. The project will still operate the same.
Hover over the PLUS signs for extra tips


Here’s what your invention should look like once it’s been assembled.
We decided to use slightly different colours of wires in ours, but this is what yours should roughly look like.
02.
Our sample code
We’ll be using this to program our invention
int led1 = 9; int led2 = 10; int led3 = 11; int touchSensor = 3; int lightPosition = led1; int pause = 100; bool btnPressed = false; long lastMove = millis(); void setup() { // put your setup code here, to run once: pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); pinMode(led3, OUTPUT); pinMode(touchSensor, INPUT); } void loop() { // put your main code here, to run repeatedly: if(millis() - lastMove >= pause) { lastMove = millis(); move(); } if(digitalRead(touchSensor)==HIGH) { if(lightPosition == led3 && btnPressed == false) { for (int x = led1; x <= led3;x++) { analogWrite(x, 50); } while(true) { } } else { btnPressed = true; } } else { btnPressed = false; } } void move() { for (int x = led1; x <= led3;x++) { digitalWrite(x, LOW); } if(lightPosition < led3) { lightPosition++; } else { lightPosition = led1; } analogWrite(lightPosition, 50); }
03.
Let’s start coding
Like with previous projects, you’ll need to add and upload the sample code to your Brain Board to get it to work. Forgotten how to do this? Click on the titles below to expand the instructions for each step of the process.
Forgotten how to do these steps? Click on the titles to expand.
Connecting & setting up the Brain Board
1. Connect to your computer
2. Select your board
Creating and saving a new 'code' document
Like in other programs you may have used like Microsoft Word, we need to create a new document to work in whenever we start something new. First launch the Arduino software that you downloaded earlier (if you didn’t, learn how to here) and select File > New in the menu at the top of the window.
You’ll notice that a new window will have popped up. It already contains some code, but we need to delete this because you will be pasting in some sample code that EduKits has written already. Select all the code using your cursor and then hit the ‘delete’ key on your keyboard to clear the existing code.
Next, select File > Save and give your project a name to save it to your account. This makes saving your work easier for later on.
Now you’re ready to upload the sample code!
Adding and uploading the sample code
1. Add the sample code
2. Upload the program
The program will ‘think’ for a moment, and then you will see lights flashing on the board very quickly for a few seconds before turning off. This means that the program has now been uploaded.
04.
Make it more annoying
Change the speed of the colour-changing cycle
For once, this change isn’t all that exciting. Since the volume of the alarm is already maxed out, the only way the volume can be changed is by bringing it down. But still, if the beeping is a little too loud, then this might be helpful. Line 14 is where the buzzer’s volume is set. Let’s take a look.
analogWrite(buzzer, 255);
The volume here is set with a value anywhere between 0 and 255, where 0 is completely off and 255 is maximum volume. Try a few different values to see what they do to the program.
Change how long each beep goes for
In line 5, you can see that we have set ‘beepLength’ to equal ‘500’. This is what’s called a variable, but more on that later. Changing this number will alter the length and space between each beep.
int beepLength = 500;
The beepLength is used in the program to control the amount of time that the beep stays on for and also the time that it is off for. This is done with a delay on lines 17 and 21 of the code.
delay(beepLength);
You always have to use a number for a delay to work properly, but because beepLength was given a number (500) earlier on in the code, that is how many milliseconds the delay will go for.
What is cool is that when we change beepLength in line 5 of the code to something else, like 750, the delay time on lines 17 and 21 will change to 750 milliseconds with it.
Connect your project to a battery
Once you’ve finished building and programming your Annoyatron project, you can connect it to a battery and take it with you. Make sure that you have disconnected the board from the computer using the blue USB cable and instead connect the included battery clip. You will also need a 9V battery (not included in the kit) to connect to the other end of the cable.
Make sure that the Brain Board is never connected to both the computer and the 9V battery at the same time. This could cause damage to both the board or your computer.
3D print a case for the Annoyatron
Pimp your Annoyatron with this new case that you can 3D print in any colour! Feeling adventurous? Open the STL files in your favourite CAD program and really make them your own.
This case holds the included UNO R3 board and has slots for a buzzer, wires, power and USB.
See the Annoyatron in Action
Let’s have some fun! Here are some cool tips, tricks and ideas for how you can use this project.
Help someone get a good night’s sleep
What about putting your invention near someone’s pillow? They’ll get a real surprise when they try to get to sleep.
This will really tick them off
Digital clocks don’t tick, do they? This one’s sure to have most people confused. Just make sure that you hide your Annoyatron better than we did.
Aaaaargh!?! Where is that noise coming from?
Try hiding your Annoyatron in a drawer full of paperwork! This ticking sound is especially annoying when you’re trying to get some work done.
Share your creations with us on Instagram!
We love to see what people are making with the Annoyatron. Snap a pic and share it on Instagram with the hashtag #Amazing Annoyatron!