Hello,
My code contains PROGMEM arrays that tell my servo motors which position to take every 0.05 seconds (with a loop). I have a particular file which allows to store these arrays. These arrays are called "arrayH2 ", "arrayV2 " etc. My servos are called “monServoH”, “monServoV”, etc.
One array = one servo.
Below is the content of my file :
// Reine de la Nuit
void Presentation() {
Serial.println("Je suis la reine de la nuit");
detachAll();
arrayHi = pgm_read_word_near(arrayH2 + 1);
arrayVi = pgm_read_word_near(arrayV2 + 1);
arrayRi = pgm_read_word_near(arrayR2 + 1);
arrayXi = pgm_read_word_near(arrayX2 + 1);
arrayYi = pgm_read_word_near(arrayY2 + 1);
**arrayLidsi = pgm_read_word_near(arrayLids2 + i);**
attachAll();
sweepH(arrayHi,50);
sweepV(arrayVi,50);
sweepR(50,20);
sweepX(arrayXi,10);
sweepY(arrayYi,10);
sweepLids(minLids,2);
monServoLids.write(minLids);
sweepJaw(minJaw,10);
detachAll();
myMP3.stop();
delay(100);
if (x == 1) {
myMP3.volume(30);
myMP3.play(4);
}
int b = analogRead(pinBusy);
int z = 1;
while (z == 1) {
delay(1000);
b = analogRead(pinBusy);
Serial.print("b=");
Serial.println(b);
if (b > 500) { delay(1); }
if (b < 500) { z = 2; }
}
int i = 14;
if (b < 500) {
attachAll();
unsigned long currentMillis = millis();
unsigned long previousMillis = millis();
Serial.println("Debut");
while (i < L2) {
currentMillis = millis();
arrayHi = pgm_read_word_near(arrayH2 + i);
arrayVi = pgm_read_word_near(arrayV2 + i);
arrayRi = pgm_read_word_near(arrayR2 + i);
arrayXi = pgm_read_word_near(arrayX2 + i);
arrayYi = pgm_read_word_near(arrayY2 + i);
**arrayLidsi = pgm_read_word_near(arrayLids2 + i);**
arrayJawi = pgm_read_word_near(arrayJaw2 + i);
monServoH.write(arrayHi);
monServoV.write(arrayVi);
monServoR.write(arrayRi);
monServoX.write(arrayXi);
monServoY.write(arrayYi);
monServoLids.write(arrayLidsi);
monServoJaw.write(arrayJawi);
b = analogRead(pinBusy);
if (currentMillis - previousMillis >= TIME2) {
i = i + 1;
previousMillis = currentMillis;
}
if (i >= L2-1 ) {
detachAll();
detach = true;
}
}
detachAll();
detach = true;
}
if (i >= L2) { // obligée de faire ça pour stopper la musique
myMP3.pause();
myMP3.volume(0);
}
}
Do you see the bold lines (edit: the lines with “**” )?
This particular command:
arrayLidsi = pgm_read_word_near(arrayLids2 + i);
If I comment them, my ESP8266 will be able to connect to Wifi.
If I don’t comment them, my ESP8266 won’t be able to connect.
I really don’t understand why.
I have tried several times, and I always have the same conclusion…
This loop works very well when I don’t use Blynk. And it works perfectly for the other arrays…
Thank you in advance for your help!