File tree Expand file tree Collapse file tree 2 files changed +46
-12
lines changed Expand file tree Collapse file tree 2 files changed +46
-12
lines changed Original file line number Diff line number Diff line change @@ -18,19 +18,29 @@ Use [the latest Arduino ESP32 core version](https://github.com/espressif/arduino
18
18
## Example code
19
19
20
20
``` c++
21
+ #include < Arduino.h>
21
22
#include < VS1053.h> /* https://github.com/baldram/ESP_VS1053_Library */
22
23
#include < ESP32_VS1053_Stream.h>
23
24
24
- #define VS1053_CS 5
25
- #define VS1053_DCS 21
26
- #define VS1053_DREQ 22
25
+ #define SPI_CLK_PIN 18
26
+ #define SPI_MISO_PIN 19
27
+ #define SPI_MOSI_PIN 23
28
+
29
+ #define VS1053_CS 5
30
+ #define VS1053_DCS 21
31
+ #define VS1053_DREQ 22
27
32
28
33
ESP32_VS1053_Stream stream;
29
34
30
35
const char * SSID = " xxx" ;
31
36
const char * PSK = " xxx" ;
32
37
33
38
void setup () {
39
+ #if defined(CONFIG_IDF_TARGET_ESP32S2) && ARDUHAL_LOG_LEVEL != ARDUHAL_LOG_LEVEL_NONE
40
+ delay (3000);
41
+ Serial.setDebugOutput(true);
42
+ #endif
43
+
34
44
Serial.begin(115200);
35
45
36
46
WiFi.begin(SSID, PSK);
@@ -41,13 +51,18 @@ void setup() {
41
51
delay (10);
42
52
Serial.println("wifi connected - starting decoder");
43
53
44
- SPI.begin(); /* start SPI before starting decoder */
54
+ SPI.setHwCs(true);
55
+ SPI.begin(SPI_CLK_PIN, SPI_MISO_PIN, SPI_MOSI_PIN); /* start SPI before starting decoder */
45
56
46
- stream.startDecoder(VS1053_CS, VS1053_DCS, VS1053_DREQ);
57
+ if (!stream.startDecoder(VS1053_CS, VS1053_DCS, VS1053_DREQ) || !stream.isChipConnected())
58
+ {
59
+ Serial.println("Decoder not running");
60
+ while (1) delay(100);
61
+ };
47
62
48
63
Serial.println("decoder running - starting stream");
49
64
50
- stream.connecttohost("http://icecast.omroep.nl/radio6-bb-mp3 ");
65
+ stream.connecttohost("http://espace.tekno1.fr/tekno1.m3u ");
51
66
52
67
Serial.print("codec: ");
53
68
Serial.println(stream.currentCodec());
Original file line number Diff line number Diff line change
1
+ #include < Arduino.h>
1
2
#include < VS1053.h> /* https://github.com/baldram/ESP_VS1053_Library */
2
3
#include < ESP32_VS1053_Stream.h>
3
4
4
- #define VS1053_CS 5
5
- #define VS1053_DCS 21
6
- #define VS1053_DREQ 22
5
+ #define SPI_CLK_PIN 18
6
+ #define SPI_MISO_PIN 19
7
+ #define SPI_MOSI_PIN 23
8
+
9
+ #define VS1053_CS 5
10
+ #define VS1053_DCS 21
11
+ #define VS1053_DREQ 22
7
12
8
13
ESP32_VS1053_Stream stream;
9
14
10
15
const char * SSID = " xxx" ;
11
16
const char * PSK = " xxx" ;
12
17
13
18
void setup () {
19
+ #if defined(CONFIG_IDF_TARGET_ESP32S2) && ARDUHAL_LOG_LEVEL != ARDUHAL_LOG_LEVEL_NONE
20
+ delay (3000 );
14
21
Serial.setDebugOutput (true );
22
+ #endif
23
+
15
24
Serial.begin (115200 );
16
25
17
26
WiFi.begin (SSID, PSK);
@@ -22,16 +31,26 @@ void setup() {
22
31
delay (10 );
23
32
Serial.println (" wifi connected - starting decoder" );
24
33
25
- SPI.begin (); /* start SPI before starting decoder */
34
+ SPI.setHwCs (true );
35
+ SPI.begin (SPI_CLK_PIN, SPI_MISO_PIN, SPI_MOSI_PIN); /* start SPI before starting decoder */
26
36
27
- stream.startDecoder (VS1053_CS, VS1053_DCS, VS1053_DREQ);
37
+ if (!stream.startDecoder (VS1053_CS, VS1053_DCS, VS1053_DREQ) || !stream.isChipConnected ())
38
+ {
39
+ Serial.println (" Decoder not running" );
40
+ while (1 ) delay (100 );
41
+ };
28
42
29
43
Serial.println (" decoder running - starting stream" );
30
44
31
- stream.connecttohost (" http://icecast.omroep.nl/radio6-bb-mp3 " );
45
+ stream.connecttohost (" http://espace.tekno1.fr/tekno1.m3u " );
32
46
33
47
Serial.print (" codec: " );
34
48
Serial.println (stream.currentCodec ());
49
+
50
+ Serial.print (" bitrate: " );
51
+ Serial.print (stream.bitrate ());
52
+ Serial.println (" kbps" );
53
+
35
54
}
36
55
37
56
void loop () {
You can’t perform that action at this time.
0 commit comments