SjoenH / keyboard-goat-dongle

An Arduino-based USB dongle that emulates a keyboard to send playful goat messages and remind users to lock their computers.
0 stars 0 forks source link

Play Random Goat Sound at Intervals #4

Open SjoenH opened 3 weeks ago

SjoenH commented 3 weeks ago

Description

Create a script that downloads and plays a random goat sound at intervals using an Arduino USB dongle. The sound file should be hosted on a remote server and triggered on macOS using afplay.

Example Implementation

void playGoatSound() {
    // Command to download the goat sound
    Keyboard.print("curl -o /tmp/goat.mp3 http://example.com/goat.mp3");
    Keyboard.press(KEY_RETURN);
    delay(1000);

    // Command to play the sound
    Keyboard.print("afplay /tmp/goat.mp3");
    Keyboard.press(KEY_RETURN);
    delay(1000);
}