Last active
December 1, 2023 20:27
-
-
Save TomyCesaille/fbf0ef30116e8cab8df565ccf5083727 to your computer and use it in GitHub Desktop.
Rain alarm - Proto 3 - Speaker + External DAC + SD Card Reader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Arduino.h" | |
#include "Audio.h" | |
#include "SD.h" | |
#include "FS.h" | |
#define SD_CS 5 | |
#define SPI_MOSI 23 | |
#define SPI_MISO 19 | |
#define SPI_SCK 18 | |
#define I2S_DOUT 25 | |
#define I2S_BCLK 27 | |
#define I2S_LRC 26 | |
Audio audio; | |
void setup() | |
{ | |
Serial.begin(115200); | |
while (!Serial) | |
; | |
pinMode(SD_CS, OUTPUT); | |
digitalWrite(SD_CS, HIGH); | |
SPI.begin(SPI_SCK, SPI_MISO, SPI_MOSI); | |
SD.begin(SD_CS); | |
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT); | |
audio.setVolume(15); // 0...21 | |
audio.connecttoFS(SD, "/Breath of the Wild [Main Theme] - The Legend of Zelda Breath of the Wild.mp3"); | |
} | |
void loop() | |
{ | |
audio.loop(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment