1
2
3
4
5
6
7
8
9#include "Arduino.h"
10#include <TFT_eSPI.h>
11#include <WiFi.h>
12#include <Audio.h>
13#include "Trance.h"
14#include "Lounge.h"
15#include "UK.h"
16#include "Talk.h"
17#include "Dance.h"
18#include "Disco.h"
19#include <SoftwareSerial.h>
20
21
22#define I2S_DOUT 25
23#define I2S_BCLK 27
24#define I2S_LRC 26
25
26SoftwareSerial serialBT;
27
28int CH_Pointer = 0;
29int OLD_Pointer = 0;
30int Volume = 15;
31int action = -1;
32int Genres = 1;
33const String Spc = " ";
34String Str = Spc;
35String Str1;
36int Sizeof;
37int SizeofTrance;
38int SizeofDance;
39int SizeofDisco;
40int SizeofLounge;
41int SizeofTalk;
42int SizeofUK;
43
44
45#define blue 0x5D9B
46#define darkred 0xA041
47
48TFT_eSPI tft = TFT_eSPI();
49Audio audio;
50
51String ssid = "********";
52String password = "********";
53
54
55void setup() {
56 Serial.begin(115200);
57 int i = 0;
58 while (Dance_Stations[i] != "EOF") {
59 i++;
60 }
61 SizeofDance = i;
62 i = 0;
63 while (Disco_Stations[i] != "EOF") {
64 i++;
65 }
66 SizeofDisco = i;
67 i = 0;
68 while (Lounge_Stations[i] != "EOF") {
69 i++;
70 }
71 SizeofLounge = i;
72 i = 0;
73 while (Talk_Stations[i] != "EOF") {
74 i++;
75 }
76 SizeofTalk = i;
77 i = 0;
78 while (Trance_Stations[i] != "EOF") {
79 i++;
80 }
81 SizeofTrance = i;
82 i = 0;
83 while (UK_Stations[i] != "EOF") {
84 i++;
85 }
86 SizeofUK = i;
87 Sizeof = SizeofTrance;
88 Serial.println(SizeofDance);
89 Serial.println(SizeofDisco);
90 Serial.println(SizeofLounge);
91 Serial.println(SizeofTalk);
92 Serial.println(SizeofTrance);
93 Serial.println(SizeofUK);
94
95
96 serialBT.begin(9600,SWSERIAL_8N1,13,12,false);
97 tft.init();
98 tft.setRotation(3);
99 tft.fillScreen(TFT_BLACK);
100 WiFi.disconnect();
101 WiFi.mode(WIFI_STA);
102 WiFi.begin(ssid.c_str(), password.c_str());
103 while (WiFi.status() != WL_CONNECTED) delay(1500);
104 audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
105 audio.setVolume(Volume);
106 CH_Change();
107
108}
109
110void loop(){
111
112 action = serialBT.read();
113 if (action > 0) {
114 if (action < 7) {
115 Genres = action ;
116 CH_Pointer = 0;
117 OLD_Pointer = 0;
118 serialBT.print("1");
119 CH_Change();
120 }
121 else {
122 switch (action) {
123 case 8:
124 serialBT.print(Genres);
125 serialBT.print(Str.substring(0,60));
126
127 break;
128
129 case 11:
130 if (Volume > 0 ) {
131 Volume--;
132 audio.setVolume(Volume);
133 }
134 Str1 = String(Volume) + " ";
135 serialBT.print( Str1.substring(0,2));
136
137 break;
138
139 case 12:
140 if (Volume < 21) {
141 Volume++;
142 audio.setVolume(Volume);
143 }
144 Str1 = String(Volume) + " ";
145 serialBT.print( Str1.substring(0,2));
146
147 break;
148
149 case 13:
150 if (CH_Pointer > 0) {
151 CH_Pointer--;
152 serialBT.print("1");
153 }
154 else {
155 serialBT.print("0");
156 }
157
158 break;
159
160 case 14:
161 if (CH_Pointer < Sizeof) {
162 CH_Pointer++;
163 serialBT.print("1");
164 }
165 else {
166 serialBT.print("0");
167 }
168
169 break;
170
171 case 16 :
172 audio.pauseResume();
173 break;
174
175 }
176
177 if (OLD_Pointer != CH_Pointer) {
178 OLD_Pointer = CH_Pointer;
179 CH_Change();
180
181 }
182
183 }
184
185 }
186
187
188 audio.loop();
189
190 }
191
192void CH_Change() {
193 audio.stopSong();
194 tft.setTextColor(TFT_WHITE,TFT_BLACK);
195 tft.setTextSize(3);
196 tft.setCursor(10,10);
197 tft.print("PLEASE WAIT ");
198 tft.setCursor(10,10);
199
200
201
202 switch(Genres) {
203 case 1:
204
205 Str = String(Trance_Stations [CH_Pointer])+ Spc;
206 serialBT.print(Str.substring(0,60));
207 audio.connecttohost(Trance_Stations[CH_Pointer].c_str());
208 Sizeof = SizeofTrance;
209 tft.fillScreen(TFT_BLACK);
210 tft.print("TRANCE");
211 tft.setCursor(130,10);
212 tft.println(CH_Pointer);
213 tft.setTextColor(blue,TFT_BLACK);
214 tft.setTextSize(2);
215 tft.println(Trance_Stations [CH_Pointer]);
216
217break;
218
219 case 2:
220
221 Str = String(Lounge_Stations [CH_Pointer])+ Spc;
222 serialBT.print(Str.substring(0,60));
223 audio.connecttohost(Lounge_Stations[CH_Pointer].c_str());
224 Sizeof = SizeofLounge;
225 tft.fillScreen(TFT_BLACK);
226 tft.print("LOUNGE");
227 tft.setCursor(130,10);
228 tft.println(CH_Pointer);
229 tft.setTextColor(blue,TFT_BLACK);
230 tft.setTextSize(2);
231 tft.println(Lounge_Stations [CH_Pointer]);
232break;
233
234 case 3:
235
236 Str = String(UK_Stations [CH_Pointer])+ Spc;
237 serialBT.print(Str.substring(0,60));
238 audio.connecttohost(UK_Stations[CH_Pointer].c_str());
239 Sizeof = SizeofUK;
240 tft.fillScreen(TFT_BLACK);
241 tft.print("UK");
242 tft.setCursor(130,10);
243 tft.println(CH_Pointer);
244 tft.setTextColor(blue,TFT_BLACK);
245 tft.setTextSize(2);
246 tft.println(UK_Stations [CH_Pointer]);
247break;
248
249 case 4:
250
251 Str = String(Talk_Stations [CH_Pointer])+ Spc;
252 serialBT.print(Str.substring(0,60));
253 audio.connecttohost(Talk_Stations[CH_Pointer].c_str());
254 Sizeof = SizeofTalk;
255 tft.fillScreen(TFT_BLACK);
256 tft.print("TALK");
257 tft.setCursor(130,10);
258 tft.println(CH_Pointer);
259 tft.setTextColor(blue,TFT_BLACK);
260 tft.setTextSize(2);
261 tft.println(Talk_Stations [CH_Pointer]);
262break;
263
264 case 5:
265
266 Str = String(Dance_Stations [CH_Pointer])+ Spc;
267 serialBT.print(Str.substring(0,60));
268 audio.connecttohost(Dance_Stations[CH_Pointer].c_str());
269 Sizeof = SizeofDance;
270 tft.fillScreen(TFT_BLACK);
271 tft.print("DANCE");
272 tft.setCursor(130,10);
273 tft.println(CH_Pointer);
274 tft.setTextColor(blue,TFT_BLACK);
275 tft.setTextSize(2);
276 tft.println(Dance_Stations [CH_Pointer]);
277break;
278
279 case 6:
280
281 Str = String(Disco_Stations [CH_Pointer])+ Spc;
282 serialBT.print(Str.substring(0,60));
283 audio.connecttohost(Disco_Stations[CH_Pointer].c_str());
284 Sizeof = SizeofDisco;
285 tft.fillScreen(TFT_BLACK);
286 tft.print("DISCO");
287 tft.setCursor(130,10);
288 tft.println(CH_Pointer);
289 tft.setTextColor(blue,TFT_BLACK);
290 tft.setTextSize(2);
291 tft.println(Disco_Stations [CH_Pointer]);
292break;
293
294 }
295
296}
297
298
299
300
311void audio_showstation(const char *info){
312 if (tft.getCursorY() < 100) {
313 tft.setTextColor(TFT_WHITE,TFT_BLACK);
314 tft.print(info);
315 }
316}
317
337
PatrickVB
9 months ago
C:\Users\plsma\Documents\Arduino\libraries\EspSoftwareSerial\src/SoftwareSerial.h:24:10: fatal error: circular_queue.h: No such file or directory #include <circular_queue.h> ^~~~~~~~~~~~~~~~~~ compilation terminated. exit status 1 Compilation error: exit status 1 Done everything as project described Get the above error