Skip to content

Instantly share code, notes, and snippets.

@stonehippo
Created August 8, 2022 02:19
Show Gist options
  • Save stonehippo/33ea5c30bec8f26950a56d689500b439 to your computer and use it in GitHub Desktop.
Save stonehippo/33ea5c30bec8f26950a56d689500b439 to your computer and use it in GitHub Desktop.
A quick test of the screamer
#define SOUND_TRIGGER 9 // the pin attached to a trigger on the sound FX board
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
// set up the pin for the sound trigger, including pulling it high
pinMode(SOUND_TRIGGER, OUTPUT);
digitalWrite(SOUND_TRIGGER, HIGH);
}
void loop() {
Serial.println("Triggering sound!");
digitalWrite(LED_BUILTIN, HIGH);
trigger_sound();
digitalWrite(LED_BUILTIN, LOW);
delay(2000); // wait a couple of seconds
}
// fire off the sound
void trigger_sound() {
Serial.println("trigger started");
digitalWrite(SOUND_TRIGGER, LOW);
delay(150); // you can try increasing or decreasing this length if the trigger does not fire
digitalWrite(SOUND_TRIGGER, HIGH);
Serial.println("trigger reset");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment