I am attempting to play sounds on the Raspberry Pi remotely by publishing an event from my phone and having the Pi start a script to play the sound when the event is received. The script, which is located in the /home/pi directory, reads as such:
sudo python /home/pi/huell.py
And in huell.py:
import os os.system('mpg123 -q Closed.mp3 &')
When I run the script (which is an executable) from the Pi directly, everything works fine. However, when I run it using Process::run(), no sound plays, despite the fact that the error code comes out to 0.
Code being flashed to the Pi:
Process proc = Process::run("/home/pi/startSound.sh"); proc.wait(); bool done = proc.exited(); int num = proc.exitCode(); Particle.publish((String(num))); String error = proc.err().readString(); String out = proc.out().readString(); Particle.publish(error); Particle.publish(out);