Fork me on GitHub

Project Notes

#043 HitTheLights

A simple LED game with LCD output.

Notes

This is a quick build in response to a question on EE.SE. It demonstrates there’s no issue driving a series of LEDs and a 16x2 LCD at the same time.

Game Mechanics

I’m not sure what the OP had in mind, but here’s my version of the game:

Objective

  • turn off all the LEDs as fast as possible

Rules

  • LED1 to 4 turn on for a brief period in sequence
  • pressing the button while the LED is on will disable it
  • LEDs need to be disabled in sequence, LED4 to LED1
  • game is over when all LEDs are off

The code keeps track of the current best score. It is not saved so will be lost over each reset of the Arduino.

The code is easily modified to do things like crank up the difficulty on each attempt. With the default settings, the game is stupidly easy to play i.e. the anti Flappy Bird of the Arduino world.

Handling the Button Press

Pushbutton is connected to pin 2, which is attached to hardware interrupt 0.

Normally the input is pulled low, but when the button is pressed, the pin is pulled high, triggering the RISING interrupt.

There is no debouncing implemented. Not that it matters much wiht this circuit, but I haven’t seen any bouncing quirks so far.

Construction

The Breadboard

The Schematic

The Build

Credits and References

About LEAP#43 LCDHuman InputArduino
Project Source on GitHub Project Gallery Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is just my personal collection of projects. Two main themes have emerged in recent years, sometimes combined:

  • electronics - usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting
  • scale modelling - I caught the bug after deciding to build a Harrier during covid to demonstrate an electronic jet engine simulation. Let the fun begin..
To be honest, I haven't quite figured out if these two interests belong in the same GitHub repo or not. But for now - they are all here!

Projects are often inspired by things found wild on the net, or ideas from the many great electronics and scale modelling podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know (or send a PR!). See the individual projects for credits where due.