Two-Player Racing Game on a WS2812B LED Strip

Two-Player Racing Game on a WS2812B LED Strip

Two players, two buttons, and a five-meter strip of addressable LEDs are all it takes to turn a length of hallway into a racetrack — mash your button faster than your opponent, and your colored car pulls ahead down the strip.

A 150-pixel strip can require several amperes. Use a fused supply, feed power at suitable points, add a bulk capacitor, share ground, and drive the speaker through an appropriate stage.

Components needed

An Arduino Nano, a 5-meter WS2812B RGB LED strip with 150 LEDs, a 330Ω resistor on the data line, two push buttons with 1kΩ pull-down resistors, and a small speaker with a capacitor for audio.

Wiring it up

The LED strip's data input connects to a digital pin through the protective resistor, each button connects to its own digital pin with its pull-down resistor, and the speaker connects through a capacitor to a PWM-capable pin for sound effects.

How the race works

Player 1 (green) and Player 2 (red) each rapidly press their own button to accelerate their car forward along the strip. The simulation isn't just simple movement — it factors in friction slowing the cars down between presses and gravity effects tied to simulated track terrain, visualized as blue gradient sections representing elevation changes along the strip.

Winning the race

The first car to complete five laps wins. As the race nears its end, the losing player's car visibly slows while the leader accelerates toward the finish, and the entire strip lights up in the winner's color while the speaker plays a victory tune.

How this compares to our Mini Cyclone game

Where Mini Cyclone is a single-player precision-timing game on a small LED ring, this project is a head-to-head, physics-driven racing game on a much longer strip — both use the same WS2812 family of addressable LEDs, but the gameplay, physics simulation, and multiplayer competition here make it a genuinely different kind of project to build.

You can find WS2812B LED strips at Juthour Tech.

اترك تعليقا

*
*
يمكن للأعضاء المسجلين فقط ترك تعليقات.