Shooting Gallery Project using Raspberry Pi and Light Sensors
Автор: Mike Young
Загружено: 2025-06-21
Просмотров: 4
Описание:
While putzing around with my new Nerf Rival blasters and testing out my 3D camcorders, I got to thinking it would be really cool to make my own Raspberry Pi-based mini shooting gallery for plinking cans. I know there are targets for sale online for something like this, both electronic and non-electronic. They look somewhat fun and are pretty inexpensive, though plinking cans is more fun, as is writing custom computer programs for creative shooting gallery game modes. A Raspberry Pi, or some other similar SBC (a $20 Libre Computer La Frite comes to mind, though I happened to have an available RPi 3A+) rigged on a simple, custom wooden shelf, with some light sensors, and set to auto-run a C program at boot and login could work well.
Instead of having a screen and buttons for player I/O, I additionally got to thinking it would be easy and cost effective to just connect a speaker and use synthetized speech. I've used Festival Lite to handy and entertaining results with a trivia game I wrote a while ago, so this would be easy an adaption. I suppose I could even have it auto-power down if the sensors are uncovered after a few minutes, going completely buttonless and utilitarian.
Here I'm simulating triggering a light sensor connected to GPIO 17. I wrote a ~100 line C program for starters to test this out. I have the program instruct the user to place cans over the sensors. The game starts 10 seconds after all sensors are covered. It uses the pigpio C library for interfacing with the GPIO. When the player knocks over all the cans the program announces game over and how long it took the player to knock them all over. Right now I'm not using precision timing, though I'll definitely be adding that. There's lots of potential to make this more involved and have more game modes and even multiplayer modes, but just starting with the basics for now and build off that. Next comes waiting for light sensors and wiring to arrive in the mail, then get to building the shelves and actually trying it out!
Повторяем попытку...

Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: