I'm apparently worse at Python than I thought I was. And I knew I was terrible. I am now desperate for help! My daughter has trouble falling asleep. We have been putting audiobooks on her tablet to help her fall asleep, but if the book runs out, she has to look at her tablet screen to start another one. And screens wake you up! So, it's a vicious cycle.
I found some instructions for a white noise machine that played a random MP3 of rain sounds. I was going to modify it a bit to work for my project. I bought a pi 0 w and a speaker pHAT. Soldered that bad boy together, and added a button to start the PI after shut down. Everything works great! So, I went in to build the code.
Turns out, the instructions I had were extremely out of date. And I can't confirm they worked even when they were cutting edge... I have looked at a bunch of other similar projects and haven't been able to figure it out at all. At this point, the only code I KNOW I have that works is,
Code: Select all
import random print("Wow, I am terrible at this")
I would like the code to play a random mp3 file from a folder (I am happy to type a list of all the files in the folder if that is easier than pulling a random file from a folder. If that makes sense.). Then shut the PI down (shut down can be after a specified time if that is easier than after a file is finished playing).
It's a PI 0 w with Raspian, which has been updated recently. I would like it to play the files on VLC Media Player, as I have the Speaker pHAT configured to work on VLC.
If anyone knows of or is working on, similar projects that are working in Python 3, please point me that direction! I haven't been able to find anything. If anyone has a spare few minutes to help a little girl and wants to write some code, that would be most appreciated too! (though, that is obviously a huge ask.)
Thanks in advance!
PS, here's the hardware.