This repo is designed to run on a Raspberry Pi with audio playback (used with pimoronis Speaker pHAT) and a lightsabersensor wired up on top of the shield (see schematics).
Tried and tested with (not included in this repo):
- Raspberry Pi zero W
- Pimoroni Speaker pHAT (Assumes you installed the shield and the provided libraries.)
- Lightsensitive sensor
- Bunch of mp3's in the /input/ folder
All Python dependencies should be available preinstalled on a Raspberry Pi. It uses the RPi library to address the pins and pygame library to handle playback.
The script assumes the schema as shown below. For identifying pins on the Raspberry Pi, take a look at pinout.xyz. This config doesn't interfere with the pins reserved for the speaker shield.
RaspPi Pin | RaspPi function |
---|---|
5 | GPIO 3 |
6 | GND |
RaspPi Pin | RaspPi function |
---|---|
36 | GPIO 16 |
34 | GND |
Sensor | RaspPi Pin | RaspPi function |
---|---|---|
GND | 20 | GND |
VCC | 17 | 3.3v |
SIGNAL D0 | 19 | GPIO 10 |
- Clone the repo to your pi
- Make sure there's an /input/ folder with *.mp3s on the root level
- The script just tries to play a random file from the folder, so only place media files over here!
Then run the script:
python start.py
Want it to start up the script automagically? Take a look at these instructions
- Fork this repository (Click the Fork button in the top right of this page, click your Profile Image)
- Clone your fork down to your local machine
git clone https://github.com/your-username/randomtale-api.git
- Create a branch
git checkout -b branch-name
- Make your changes (choose from any task below)
- Commit and push
git add .
git commit -m 'Commit message'
git push origin branch-name
- Create a new pull request from your forked repository (Click the
New Pull Request
button located at the top of your repo).
This project is licensed under the MIT License - see the LICENSE.md file for details