Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8621

Beginners • Re: RPi3 Python and Motion Sensor Project

$
0
0
This will print a random wav from the list:

Code:

import subprocessimport random# list of .wav filesplaylist = ["mistsoftime", "purplehaze","snowblind", "trooper", "wheelsofsteel"]w=len(playlist)n = random.randint(0,w-1)subprocess.run(["aplay","/home/pi/Music/"+playlist[n]+".wav"])

Statistics: Posted by neilgl — Fri Aug 08, 2025 1:02 pm



Viewing all articles
Browse latest Browse all 8621

Trending Articles