
Error compilando para la tarjeta Arduino uno
Publicado por bssman (1 intervención) el 05/09/2021 20:22:29
Muy buenas a todos,
llevo horas intentando depurar mi script, pro soy incapaz de encontrar el error que me da al compilar.
¿Hay alguien que podría echar un vistazo?
Dejo aquuí el script en el cual estoy trabajando. Soy bastante novato y desgraciadamente mi tiempo no me permite meter me más a fodo, así que voy coo voy :(
Gracias de antemano
llevo horas intentando depurar mi script, pro soy incapaz de encontrar el error que me da al compilar.
¿Hay alguien que podría echar un vistazo?
Dejo aquuí el script en el cual estoy trabajando. Soy bastante novato y desgraciadamente mi tiempo no me permite meter me más a fodo, así que voy coo voy :(
Gracias de antemano
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
// Programa para mochilas ghostbusters Reboot VERSIÓN HOLTZMANN
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Requerido para 16 MHz Adafruit Trinket
#endif
// adición para música
#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
SoftwareSerial mySoftwareSerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;
// Cuáles de los pines están conectados al Neopixel, Con una Trinket o Gemma ponerlo en salida 1
#define NUMBERS_PIN 2 // números (cable naranja)
#define BAR_PIN 3 // barra de leds (cable amarillo)
#define LEDS_PIN 4 // reactor pequeño chimenea (cable verde)
#define LEDCIRCLE_PIN 5 // reactor circular(cable lila)
#define ENERGIA_PIN 9 // energía pistola
// #define BARRIL_PIN ?? // barril pistola
//Cuántas leds en cada elemento
#define NUMBERS_COUNT 2
#define BAR_COUNT 8
#define LEDS_COUNT 2
#define LEDCIRCLE_COUNT 24
#define ENERGIA_COUNT 4
// #define BARRIL_COUNT 4
// Declara lo(s) NeoPixel circle - bar - leds - numbers - energia:
Adafruit_NeoPixel stripnumbers(NUMBERS_COUNT, NUMBERS_PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel stripbar(BAR_COUNT, BAR_PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel stripleds(LEDS_COUNT, LEDS_PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel stripcircle(LEDCIRCLE_COUNT, LEDCIRCLE_PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel stripenergia(ENERGIA_COUNT, ENERGIA_PIN, NEO_GRB + NEO_KHZ800);
// Adafruit_NeoPixel stripbarril(BARRIL_COUNT, BARRIL_PIN, NEO_GRB + NEO_KHZ800);
// Argumento 1 = Número de pixels in NeoPixel
// Argumento 2 = Número de pin de Arduino
// Argumento 3 = Tipo de pixel, juntar si procede:
// NEO_KHZ800 800 KHz bitstream (la mayoría de productos de w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (clássico 'v1' (no v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels están preparadas para GRB bitstream (mayoría de productos NeoPixel)
// NEO_RGB Pixels están preparadas para RGB bitstream (v1 FLORA pixels, no v2)
// NEO_RGBW Pixels están preparadas para RGBW bitstream (productos NeoPixel RGBW)
// setup() Función que será leída 1 vez al arrancar el programa --------------------------------
void setup() {
stripcircle.begin(); // INICIALIZA EL OBJETO STRIPCIRCLE (REQUIRRIDO)
stripcircle.show(); // apaga todos los pixels
stripcircle.setBrightness(204); // Pone intensidad en la luz 80% (max = 255) según la intensidad, irá el consumo de las leds
stripbar.begin(); // INICIALIZA EL OBJETO STRIPBAR (REQUIRRIDO)
stripbar.show(); // apaga todos los pixels
stripbar.setBrightness(190); // Pone intensidad en la luz 75% (max = 255)
//stripbarril.begin(); // INICIALIZA EL OBJETO STRIPBARRIL (REQUIRRIDO)
//stripbarril.show(); // apaga todos los pixels
//stripbarril.setBrightness(204); // Pone intensidad en la luz 80% (max = 255)
stripenergia.begin(); // INICIALIZA EL OBJETO STRIPENERGIA Y EL BARRIL (REQUIRRIDO)
stripenergia.show(); // apaga todos los pixels
stripenergia.setBrightness(204); // Pone intensidad en la luz 80% (max = 255)
stripleds.begin(); // INICIALIZA EL OBJETO STRIPLEDS (la chimenea) (REQUIRRIDO)
stripleds.show(); // apaga todos los pixels
stripleds.setBrightness(190); // Pone intensidad en la luz 75% (max = 255)
stripnumbers.begin(); // INICIALIZA EL OBJETO STRIPNUMBERS (REQUIRRIDO)
stripnumbers.show(); // apaga todos los pixels
stripnumbers.setBrightness(230); // Pone intensidad en la luz 90% (max = 255)
mySoftwareSerial.begin(9600);
Serial.begin(115200);
myDFPlayer.volume(25); //Set volume value. From 0 to 30
myDFPlayer.EQ(DFPLAYER_EQ_NORMAL);
myDFPlayer.outputDevice(DFPLAYER_DEVICE_SD);
// myDFPlayer.next(); //Play next mp3
// delay(1000);
// myDFPlayer.previous(); //Play previous mp3
// delay(1000);
// myDFPlayer.play(1); //Play the first mp3
// delay(1000);
// myDFPlayer.loop(1); //Loop the first mp3
// delay(1000);
// myDFPlayer.pause(); //pause the mp3
// delay(1000);
// myDFPlayer.start(); //start the mp3 from the pause
// delay(1000);
// myDFPlayer.playFolder(15, 4); //play specific mp3 in SD:/15/004.mp3; Folder Name(1~99); File Name(1~255)
// delay(1000);
// myDFPlayer.enableLoopAll(); //loop all mp3 files.
// delay(1000);
// myDFPlayer.disableLoopAll(); //stop loop all mp3 files.
// delay(1000);
// myDFPlayer.playMp3Folder(4); //play specific mp3 in SD:/MP3/0004.mp3; File Name(0~65535)
// delay(1000);
// myDFPlayer.advertise(3); //advertise specific mp3 in SD:/ADVERT/0003.mp3; File Name(0~65535)
// delay(1000);
// myDFPlayer.stopAdvertise(); //stop advertise
// delay(1000);
// myDFPlayer.playLargeFolder(2, 999); //play specific mp3 in SD:/02/004.mp3; Folder Name(1~10); File Name(1~1000)
// delay(1000);
// myDFPlayer.loopFolder(5); //loop all mp3 files in folder SD:/05.
// delay(1000);
// myDFPlayer.randomAll(); //Random play all the mp3.
// delay(1000);
// myDFPlayer.enableLoop(); //enable loop.
// delay(1000);
// myDFPlayer.disableLoop(); //disable loop.
// delay(1000);
}
// loop() function -- Funciona mientras haya corriente en la placa Arduino ---------------
void loop() {
// Las animaciones programadas en los diferentes voids
// Arrancar la primera parte del programa y terminar todo en rojo
colorWipeLEDS(stripleds.Color(0, 255, 0), 300); // Green -leds
colorWipeNumbers(stripnumbers.Color(0, 255, 0), 50); // Green - numbers
colorWipeLEDS(stripleds.Color(255, 0, 0), 300); // Red - leds
colorWipeenergia(stripenergia.Color(0, 0, 255), 150); // BLUE - energia
colorWipeLEDS(stripleds.Color(0, 255, 0), 300); // Green -leds
colorWipeLEDS(stripleds.Color(255, 0, 0), 300); // Red - leds
colorWipeLEDS(stripleds.Color(0, 0, 255), 300); // BLUE - leds
colorWipeBar(stripbar.Color(0, 255, 0), 150); // Green - Bar
colorWipeNumbers(stripnumbers.Color(255, 255, 255), 50); // White - numbers
colorWipeenergia(stripenergia.Color(0, 255, 0), 150); // Green - energia
colorWipeNumbers(stripnumbers.Color(0, 255, 0), 50); // Green - numbers
colorWipeLEDS(stripleds.Color(255, 0, 0), 300); // Red - leds
colorWipeLEDS(stripleds.Color(0, 255, 0), 300); // Green -leds
colorWipeLEDS(stripleds.Color(255, 0, 0), 300); // Red - leds
colorWipeLEDS(stripleds.Color(0, 255, 0), 300); // Green -leds
colorWipeLEDS(stripleds.Color(0, 0, 255), 300); // BLUE - leds
colorWipeLEDS(stripleds.Color(255, 0, 0), 300); // Red - leds
OPSTARTEN();
RainbowStripCircle(200);
colorWipeCircle(stripcircle.Color(255, 0, 0), 100); // Red - Circle --------------RED
colorWipeBar(stripbar.Color(0, 0, 255), 150); // BLUE - Bar
colorWipeLEDS(stripleds.Color(0, 0, 255), 300); // BLUE - leds
colorWipeLEDS(stripleds.Color(0, 255, 0), 300); // Green - leds
colorWipeLEDS(stripleds.Color(255, 0, 0), 300); // Red - leds --------------------RED
colorWipeNumbers(stripnumbers.Color(255, 0, 20), 100); // Red - numbers ----------RED
RainbowStripBar(250);
colorWipeBar(stripbar.Color(255, 0, 0), 150); // Red - Bar --------------------------RED
colorWipeenergia(stripenergia.Color(255, 0, 0), 150); // Red - energia --------------RED
// Juego de luces, siempre terminando en azul
colorWipeNumbers(stripnumbers.Color(255, 255, 255), 100); // White - numbers
RainbowStripBar(250);
ALARM();
TheaterChaseCircle(stripcircle.Color(0, 255, 0), 100); // Green - Circle
colorWipeCircle(stripcircle.Color(255, 0, 0), 50); // Red - Circle
colorWipeCircle(stripcircle.Color(0, 255, 0), 40); // Green - Circle
colorWipeCircle(stripcircle.Color(255, 0, 0), 30); // Red - Circle
colorWipeCircle(stripcircle.Color(0, 255, 0), 20); // Red - Circle
TheaterChaseCircle(stripcircle.Color(255, 0, 0), 100); // Red - Circle
TheaterChaseCircle(stripcircle.Color(0, 255, 0), 100); // Green - Circle
TheaterChaseCircle(stripcircle.Color(255, 0, 0), 100); // Red - Circle
colorWipeenergia(stripenergia.Color(0, 255, 0), 150); // Green - energia
colorWipeenergia(stripenergia.Color(255, 0, 0), 150); // Red - energia
colorWipeBar(stripbar.Color(255, 0, 0), 150); // Red - Bar
colorWipeNumbers(stripnumbers.Color(0, 0, 255), 100); // BLUE - numbers
colorWipeBar(stripbar.Color(0, 255, 0), 150); // Green - Bar
colorWipeBar(stripbar.Color(255, 0, 0), 150); // Red - Bar
colorWipeenergia(stripenergia.Color(0, 0, 255), 100); // BLUE - energia
colorWipeenergia(stripenergia.Color(0, 255, 0), 100); // Green - energia
colorWipeLEDS(stripleds.Color(0, 255, 0), 250); // Green - leds
colorWipeenergia(stripenergia.Color(255, 0, 0), 100); // Red - energia
colorWipeLEDS(stripleds.Color(255, 0, 0), 200); // Red - leds
colorWipeLEDS(stripleds.Color(0, 0, 255), 200); // BLUE - leds
TheaterChaseCircle(stripcircle.Color(0, 255, 0), 75); // Green - Circle
colorWipeCircle(stripcircle.Color(255, 0, 0), 75); // Red - Circle
colorWipeLEDS(stripleds.Color(0, 255, 0), 200); // Green - leds
RainbowStripBar(250);
colorWipeCircle(stripcircle.Color(255, 0, 0), 75); // Red - Circle
TheaterChaseCircle(stripcircle.Color(0, 255, 0), 75); // Green - Circle
TheaterChaseCircle(stripcircle.Color(255, 0, 0), 75); // Red - Circle
colorWipeenergia(stripenergia.Color(0, 0, 255), 100); // BLUE - energia
colorWipeenergia(stripenergia.Color(0, 255, 0), 100); // Green - energia
colorWipeBar(stripbar.Color(255, 0, 0), 150); // Red - Bar
colorWipeLEDS(stripleds.Color(255, 0, 0), 200); // Red - leds
colorWipeLEDS(stripleds.Color(0, 0, 255), 200); // BLUE - leds ---ENDCOLOR
TheaterChaseCircle(stripcircle.Color(0, 255, 0), 100); // Green - Circle
TheaterChaseCircle(stripcircle.Color(255, 0, 0), 100); // Red - Circle
colorWipeenergia(stripenergia.Color(255, 0, 0), 150); // Red - energia
colorWipeenergia(stripenergia.Color(0, 255, 0), 100); // Green - energia
colorWipeNumbers(stripnumbers.Color(255, 255, 255), 100); // BLUE - numbers ----ENDCOLOR
RainbowStripBar(150);
colorWipeBar(stripbar.Color(255, 0, 0), 150); // Red - Bar
colorWipeBar(stripbar.Color(0, 255, 0), 150); // Green - Bar
colorWipeBar(stripbar.Color(255, 0, 0), 150); // Red - Bar
colorWipeBar(stripbar.Color(0, 0, 255), 150); // BLUE Bar ---ENDCOLOR
colorWipeCircle(stripcircle.Color(0, 0, 255), 75); // BLUE - Circle ---ENDCOLOR
RainbowStripEnergia(150);
colorWipeenergia(stripenergia.Color(0, 0, 255), 150); // BLUE - energia ---ENDCOLOR
}
// Funciones propias para crear efectos -----------------
// Cada pixel será llenado de un color. Los pixels no serán eliminados, pero el color nuevo se pondrá encima.
//Colores(rojo, verde, azul) como mostrado en la loop() function arribae, y un delay time (in millisegundos) entre pixels.
void colorWipeCircle(uint32_t color, int wait) {
for (int i = 0; i < stripcircle.numPixels(); i++) { // Para cada pixel en el elemento
stripcircle.setPixelColor(i, color); // Fija el color en la RAM
stripcircle.show(); // Actualizar
delay(wait); // Pausa
}
}
void colorWipeBar(uint32_t color, int wait) {
for (int i = 0; i < stripbar.numPixels(); i++) {
stripbar.setPixelColor(i, color);
stripbar.show();
delay(wait);
}
}
void colorWipeNumbers(uint32_t color, int wait) {
for (int i = 0; i < stripnumbers.numPixels(); i++) {
stripnumbers.setPixelColor(i, color);
stripnumbers.show();
delay(wait);
}
}
void colorWipeLEDS(uint32_t color, int wait) {
for (int i = 0; i < stripleds.numPixels(); i++) {
stripleds.setPixelColor(i, color);
stripleds.show();
delay(wait);
}
}
void colorWipeenergia(uint32_t color, int wait) {
for (int i = 0; i < stripenergia.numPixels(); i++) {
stripenergia.setPixelColor(i, color);
stripenergia.show();
delay(wait);
}
}
// Luces de una marquesina
void TheaterChaseCircle(uint32_t color, int wait) {
for (int a = 0; a < 2; a++) { // Repeat 2 times...
for (int b = 0; b < 23; b++) { // 'b' counts from 0 to 24...
stripcircle.clear(); // Set all pixels in RAM to 0 (off)
// 'c' counts up from 'b' to end of strip in steps of 2...
for (int c = b; c < stripcircle.numPixels(); c += 1) {
stripcircle.setPixelColor(c, color); // Set pixel 'c' to value 'color'
}
stripcircle.show();
delay(wait);
}
}
}
// Ciclo de arcoiris por todo el círculo. Tiempo de espera en vueltas en milisegundos.
void RainbowStripCircle(int wait) {
for (long firstPixelHue = 0; firstPixelHue < 2 * 65536; firstPixelHue += 256) {
for (int i = 0; i < 35; i++) {
int pixelHue = firstPixelHue + (i * 65536L / stripcircle.numPixels());
stripcircle.setPixelColor(i, stripcircle.gamma32(stripcircle.ColorHSV(pixelHue)));
}
stripcircle.show();
//delay(wait);
}
}
// Ciclo de arcoiris por todo la barra. Tiempo de espera en vueltas en milisegundos = void del círculo
void RainbowStripBar(int wait) {
for (long firstPixelHue = 0; firstPixelHue < 2 * 65536; firstPixelHue += 256) {
for (int i = 0; i < 50; i++) {
int pixelHue = firstPixelHue + (i * 65536L / stripbar.numPixels());
stripbar.setPixelColor(i, stripbar.gamma32(stripbar.ColorHSV(pixelHue)));
}
stripbar.show();
//delay(wait);
}
}
// Ciclo de arcoiris por todo la energia. Tiempo de espera en vueltas en milisegundos = void del círculo
void RainbowStripEnergia(int wait) {
for (long firstPixelHue = 0; firstPixelHue < 2 * 65536; firstPixelHue += 256) {
for (int i = 0; i < 50; i++) {
int pixelHue = firstPixelHue + (i * 65536L / stripbar.numPixels());
stripenergia.setPixelColor(i, stripenergia.gamma32(stripenergia.ColorHSV(pixelHue)));
}
stripenergia.show();
//delay(wait);
}
}
void OPSTARTEN() {
myDFPlayer.play(1);
delay(6000);
}
void ALARM() {
myDFPlayer.play(5);
delay(6000);
}
void GHOSTBUSTERS() {
myDFPlayer.play(2);
delay(6000);
}
Valora esta pregunta


0