Introduction: Play Sound on Pc With Arduino and Progduino
Today I will show you how easy it is to build a simple player and run it on the computer with arduino and progduino.
Learn more about progduino : http://www.progduino.com
Step 1: Arduino Code - Player on Your Pc.
copy the code to your arduino editor.
void setup()
{
Serial.begin(9600);
ProgduinoRunOnce();
}
void loop()
{
}
void ProgduinoRunOnce(){
Serial.println(F("WindowSize; width:360; height:110; title:Music Player;"));
Serial.println(F("CreateButton; width:100; height:50; top:10; left:10; fontsize:12; name:button1; text:PLAY;"));
Serial.println(F("CreateButton; width:100; height:50; top:10; left:120; fontsize:12; name:button2; text:PAUSE;"));
Serial.println(F("CreateButton; width:100; height:50; top:10; left:230; fontsize:12; name:button3; text:STOP;"));
Serial.println(F("OnClick; control:button1; mediaplayer.play:snd.wav;"));
Serial.println(F("OnClick; control:button2; mediaplayer.pause;"));
Serial.println(F("OnClick; control:button3; mediaplayer.stop;"));
}
You can add your sound files to the sound folder inside Progduino folder (Replace the file name "snd.wav" to your file name).
Step 2: Play Sound Directly From Arduino
int buttonState = 0;
const int buttonPin = 2;
void setup()
{
Serial.begin(9600);
pinMode(buttonPin, INPUT);
ProgduinoRunOnce();
}
void loop()
{
buttonState = digitalRead(buttonPin);
if(buttonState == HIGH){
Serial.println(F("RunFunction; mediaplayer.play:snd.wav;"));
delay(1000);
}
}
void ProgduinoRunOnce(){
Serial.println(F("WindowSize; width:800; height:600 title:Music Player;"));
}
You can add your sound files to the sound folder inside Progduino folder (Replace the file name "snd.wav" to your file name).




