Go Down

Topic: Problem with runShellCommand and Madplay (Read 211 times) previous topic - next topic

Herminator

Dec 01, 2017, 01:15 am Last Edit: Dec 01, 2017, 01:21 am by Herminator
I'm working on a small project for the holidays, using an arduino yun, a usb soundcard and madplay. The problem I'm having is that I can't get it to work in my own sketch.

The serial print keeps looping, so the code seems to work - but it might be skipping the audio file.

Quote
#include <Process.h>

const int buttonPin = 2;

int buttonState = 0;
Process p;

void setup() {
  Bridge.begin();
  pinMode(buttonPin, INPUT);    
  Serial.begin(38400);
}

void loop(){
  buttonState = digitalRead(buttonPin);
  if (buttonState == HIGH) {    
    p.runShellCommand("madplay /root/svfout.mp3");
    while(p.running());  
    Serial.println("it works!");
  }
  else {
  }
}
Using the terminal example, I can play the audio just fine. Meaning it isn't a hardware or file problem  :smiley-confuse:
I'm totally stuck at the moment, so any help would be greatly appreciated!

I used this tutorial: https://dev.mikamai.com/2013/12/12/arduino-yun-with-sound-the-supereasy-way/

Go Up