Solving the 8-Queens Puzzle with an Adafruit 8×8 Mini LED Matrix
Dennis wrote in to share a project that students at Storming Robots have been working on.
Received an Adafruit Mini 8×8 LED Matrix w/I2C Backpack today. After soldering and testing I wanted to try something else with it.
Some students here have been programming the classic 8-Queens puzzle where 8 queens must be placed on a chess board such that no two queens can take each other. I thought the 8×8 matrix would make a good ‘chessboard’. Each lit LED is a placement for a queen in a particular solution. I have it hooked up to a large “breadboard Arduino” that I like using for testing things out. Naturally this will work with an Uno/Mega just fine. For more info on the 8-Queens problem see the Wikipedia article.
Note: It runs through the 92 solutions pretty fast. I was hand holding the camera and didn’t want to make the video too long. I might post a video later with a longer delay between solutions.
What’s better than a single LED? Lots of LEDs! A fun way to make a small display is to use an 8×8 matrix or a 4-digit 7-segment display. Matrices like these are ‘multiplexed’ – so to control 64 LEDs you need 16 pins. That’s a lot of pins, and there are driver chips like the MAX7219 that can control a matrix for you but there’s a lot of wiring to set up and they take up a ton of space. Here at Adafruit we feel your pain! After all, wouldn’t it be awesome if you could control a matrix without tons of wiring? That’s where these adorable LED matrix backpacks come in. We have them in two flavors – a mini 8×8 and a 4-digit 0.56″ 7-segment. They work perfectly with the matrices we stock in the Adafruit shop and make adding a bright little display trivial.
Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.