Home / Projects / PIC Projects / Catch the Light PIC Game

Catch the Light PIC Game

This project is a simple PIC game where LEDs go on randomly one at a time. The objective is to “catch” the LED that’s on by pressing the corresponding button. For every catch, the score, displayed on a seven segment display, is incremented. The speed of the LEDs increase every time the score goes beyond multiples of 5 (10, 15, 20).


This a good PIC project for beginners. All that is needed is four LEDs, four buttons and a dual 7 segment display. This project is coded using XC8. Here’s a video of the project simulated on Proteus ISIS:

[the_ad id=”3059″]
Making the LEDs go random is done through the rand() command and using TMR1’s value as seed. Each LED has a corresponding button. If the user presses a button, the RB change interrupt is triggered and then the PORTB (buttons) value is compared to the PORTC (LEDs) values. If a match occurs, the score is incremented.

Materials Needed

  • PIC16F877A
  • Dual Seven-segment Display – Common Cathode
  • 74LS48
  • 5 x SPST Pushbuttons
  • 4 x LEDs
  • 5 x 10k ohm, 1/4 W Resistors
  • 5 x 200 ohm, 1/4 W Resistors
  • 4 MHz Crystal
  • 2 x 22pF Ceramic Capacitor

Schematic Diagram

Catch the Light! PIC Project Game

I wanted to use RB change interrupt for faster reaction time. And since this interrupt triggers via four pins (RB4 to RB7), this project is limited to four buttons and, consequently, four LEDs. More LEDs and more buttons is possible but you can’t use interrupts anymore.


Project Files

The simulation files, XC8 code and schematic diagram is free to download:

[wpdm_package id=’2074′] [the_ad id=”3059″]

Check Also

Digital Thermometer Nokia LCD

Digital Thermometer with Nokia 3310 LCD

The Nokia 3310 LCD is a cheap option for those who want to add a …

Leave a Reply

Your email address will not be published.