diff --git a/README.md b/README.md index 5cae354..d081473 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,13 @@ CLK -> D5 MISO -> D6 ``` +## TODOs +* Card Reader with SPI. Configure hspi, second SPI channel? + +![](images/wemos-d1-mini-esp32.png) ## Links https://github.com/earlephilhower/ESP8266Audio +[Running two SPI devices at once](https://randomnerdtutorials.com/esp32-spi-communication-arduino/) diff --git a/src/main.cpp b/src/main.cpp index 95b0e07..06e7b29 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -30,6 +30,8 @@ const int startDelay = 250; Audio audio; +uint volume = 18; + AsyncWebServer server(80); DNSServer dns; @@ -69,6 +71,18 @@ void audio_info(const char *info) // Serial.print("info "); Serial.println(info); } +void mute() { + if (audio.getVolume()!=0) { + volume = audio.getVolume(); + } + + audio.setVolume(0); +} + +void unmute() { + audio.setVolume(volume); +} + String getState() { String state = String(); @@ -133,7 +147,7 @@ void start() } void next() -{ +{ playNextMp3(); } @@ -170,7 +184,7 @@ void setup() // printDirectory(root, 0); audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT); - audio.setVolume(12); // 0...21 + audio.setVolume(volume); // 0...21 server.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { request->send_P(200, "text/html", index_html, processor); });