opkg update
opkg install kmod-usb-audio
opkg install madplay
cd /mnt/sda1
wget --no-check-certificate https://www.dropbox.com/s/zzowqtew6cmspsf/track39.mp3
#include <Process.h>
Process p;
void setup() {
Bridge.begin();
Serial.begin(9600); // Initialize the Serial
while (!Serial); // Wait until a Serial Monitor is connected.
}
void loop() {
if (Serial.available() > 0) {
int inByte = Serial.read();
//Serial.write(inByte);
switch (inByte) {
case 'p':
Serial.println("Play:");
p.runShellCommandAsynchronously("/usr/bin/madplay /mnt/sda1/track39.mp3");
break;
case 's':
Serial.println("Stop:");
p.runShellCommandAsynchronously("/usr/bin/killall -9 madplay");
break;
case 'r':
Serial.println("Repeat Play:");
p.runShellCommandAsynchronously("/usr/bin/madplay /mnt/sda1/track39.mp3 -r");
break;
}
}
}
p: Play
s: Stop
r: Repeat Play