Playing with the different GPIO settings I got working. I also added Internet connection OnDemand, based on Tzapu library. Next step to add a rotary switch to change the sations.
Help will always be appreciated.
Here is the current working sketch:
```cpp
#include <Arduino.h>
//#include <WiFi.h>
#include <WiFiManager.h> // https://github.com/tzapu/WiFiManager
#include <Audio.h>
#define I2S_DOUT 12
#define I2S_BCLK 13
#define I2S_LRC 14
// select which pin will trigger the configuration portal when set to LOW
#define TRIGGER_PIN 46
int timeout = 120; // seconds to run for
Audio audio;
//String ssid = "P";
//String password = "s";
void setup() {
//WiFi.disconnect();
//WiFi.mode(WIFI_STA);
//WiFi.begin(ssid.c_str(), password.c_str());
//while (WiFi.status() != WL_CONNECTED)
Serial.begin(115200);
pinMode(TRIGGER_PIN, INPUT_PULLUP);
while (digitalRead(TRIGGER_PIN) == HIGH) {
Serial.println("\n Waiting for button");
delay(1500);
}
WiFiManager wm;
//reset settings - for testing
wm.resetSettings();
// set configportal timeout
wm.setConfigPortalTimeout(timeout);
if (!wm.startConfigPortal("OnDemandAP")) {
Serial.println("failed to connect and hit timeout");
//delay(3000);
//reset and try again, or maybe put it to deep sleep
ESP.restart();
//delay(5000);
}
delay(1500);
Serial.begin(115200);
Serial.println(WiFi.localIP());
Serial.printf("Total PSRAM: %d\n", ESP.getPsramSize());
audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
audio.setVolume(100);
audio.connecttohost("https://playerservices.streamtheworld.com/api/livestream-redirect/CJFMFM.mp3");
//audio.connecttohost("http://vis.media-ice.musicradio.com/CapitalMP3");
Serial.println("Music now");
}
void loop()
{
audio.loop();
}
```