Four-Bit Maze Puzzle: a fun, easy beginner project

This implementation of Oskar van Deventer’s 4-Bit Maze is an excellent beginner Arduino project that makes simple use of momentary switches and LEDs for digital input and output, respectively. The 4-bit maze, as the name implies, is a maze with a state encoded as four binary bits and displayed as on/off LEDs. Initially, all four lights are on. The object is to turn all four lights off. Pressing a button by a light turns that light off, yet other lights may change as well. This is better experienced than described, so I recommend getting a sense of the maze by playing with the 4-bit maze Java applet at the link above.

Building the supporting circuit for the sketch is very easy. Essentially, we need to read 6 pushbuttons switches (bits 0-3, Reset, New Maze) and set 4 LEDs (bits 0-3). The building blocks for turning LEDs on/off and reading buttons are from the Loop and Button Arduino tutorials.

The working prototype is horribly messy. I’m sure others will significantly improve upon it. My hope is that this will serve as a seed for a better implemented and presented project that beginners will enjoy immensely. Recreational mathematicians can also ponder improvements to the maze generation algorithm.

I look forward to reading your thoughts and comments. Enjoy!


kool :slight_smile: i may have to make one :3

As it turns out, the four-bit maze circuit barely fits on an Arduino Protoshield. Today, I added pictures of three different prototypes (breadboard w/ Arduino Mini, Arduino Protoshield, and food storage container "dead-bug" prototype) to the project website. Enjoy!