I'm trying to figure out if there is a line of code that would communicate to the OS to play a certain sound on the computer when prompted? Anyone know?
The computer would have to be running something that could accept a (likely serial) communication from the Arduino and then play a sound. What program/service/other do you have running that would do that?
UCOEngineering:
I'm trying to figure out if there is a line of code
'A line,' no, it will take more than just one.
More accurately, it takes a small number of lines to set up the serial port. After that though, yes, you can send 'a message' through the serial pot on one line. ![]()
that would communicate to the OS...
You've probably used Serial.write() to send data to a Serial Monitor screen on the PC. Well, you can also run other software on the PC that 'listens' to the serial port and responds to messages or performs other actions based on those messages.
The -privileges- that the PC-side software has determines what it can execute: beep, send an email, or open a web browser to a particular page.
Almost every language has functions to communicate with the serial port. Use whatever you're familiar and comfortable with.
The Arduino can't do this directly - it requires cooperation from software on the PC. If the PC is running Windows, you could use GoBetwino for that - the alternative is to write your own equivalent. All the sketch would do is write the appropriate message to the serial port to command the PC application to play the sound.