Tutorial 4: An LED Game
English Chinese (Simplified) Czech French German Hindi Italian Japanese Korean Russian Spanish

In this tutorial we will show how to combine the use of digital input and output pins to build a simple LED game with the UNO R3 PLUS board.  In this game, we will blink each LED in a loop from white to yellow to green to red then back to white.  The goal of the game is to stop the LED at the exact moment when the green LED is light by pressing the tact switch.  If you get it right, the pace will speed up and the difficulty will increase.

I – Stuffs that you will need:

You will need a UNO R3 Plus board, a mini USB to standard USB cable, a PC as well as a breadboard, LEDs, resistors, jumper cables and a tact switch for assembling the circuit.

UNO R3 Plus

Mini USB to Standard USB

Windows PC



4x330ohm + 1x10kohm Resistors

Jumper cables

Tact Switch



II – Schematic Diagram:

Below is the schematic diagram, we will use digital pin 12 for input, and digital pin 2, 3, 4 and 5 for output.


III – Wiring the Breadboard

Let’s wire up the breadboard.


IV – Writing the Sketch:

Start a new project and copy and paste the below sketch into the Arduino environment.   After the sketch is loaded, you will see the LED will blink one at a time.   Each LED will light on for 200ms and off for 200ms to start.  If you manage to hit the button at the exact moment when the green LED is ON, the game will speed up by 20ms.  At the end, the LED will toggle so fast that all four LED will light up at the same time.  To restart the game, hit the reset button on the UNO R3 Plus board.




Things we have covered in this tutorial:

  • Using digital input and output pin together.



Tutorial 5: Building Voltage Meter

Tutorial 6: Using Buzzer to Play a Melody

Tutorial 7: Counting Down with a 7 Segment LED

Tutorial 8: Powering the UNO R3 PLUS Using Batteries


Download  ARD-101 Tutorial Codes