To clarify I'm extremely new to this and I'm using an Arduino Uno with a wave shield. My circuit works as intended but I haven't learned enough of the code to know what to do to make it do exactly what I want.
Right now the following code makes the sound play on button press but the led sequence doesn't at all. If I move root.rewind(); play(root);
to after the last digitalWrite
then the led sequence runs but the audio doesn't play until the led sequence ends. I'm out to make the audio play while the led sequence runs. Any suggestions?
if (state == 1) {
root.rewind();
play(root);
for (i = 0; i < 255; i++) { // loop from 0 to 254 (fade in)
analogWrite(LED,i); // set the LED brightness
delay(15); // wait 15ms because analogWrite
// is instantaneous and we would
// not see any change
}
analogWrite(LED, HIGH); // turns the LED on
delay(300); // waits for a second
analogWrite(LED, LOW); // turns the LED off
delay(100); // waits for a second
analogWrite(LED, HIGH); // turns the LED on
delay(300); // waits for a second
analogWrite(LED, LOW); // turns the LED off
delay(100); // waits for a second
digitalWrite(RESET, LOW);
}
analogWrite(LED, HIGH);
is equivalent toanalogWrite(LED, 1);