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

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

Project Source on GitHub Return to the LEAP Catalog
About LEAP

LEAP is my personal collection of electronics projects - 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.

Projects are often inspired by things found wild on the net, or ideas from the many great electronics podcasts and YouTube channels. Feel free to borrow liberally, and if you spot any issues do let me know or send a pull-request.

NOTE: For a while I included various scale modelling projects here too, but I've now split them off into a new repository: check out LittleModelArt if you are looking for these projects.

Project Gallery view the projects as an image gallery Notebook reference materials and other notes Follow the Blog follow projects and notes as they are published in your favourite feed reader