J'utilise bien l'écriture multiple des champs pour Thingspeak.
J'avais fait le test avec un délai entre les 2 envois, et en dernier, le test sur un canal appartenant à 2 comptes Thingspeak pour éliminer le délai de mise à jour.
Donc, vous parlez de refaire une connexion, c'zst une connexion réseau ? J'avais aussi testé le ThingSpeak.begin avant chaque écriture, même problème, blocage à la deuxième écriture.
boolean connexion_modem()
{
#ifdef DEBUG
Serial.println("");
Serial.println("Connexion modem");
#endif
if ((nbAccess.begin(PINNUMBER, APN) == NB_READY) &&
(gprs.attachGPRS() == GPRS_READY)) {
#ifdef DEBUG
Serial.println("Modem connecte");
#endif
delay(500);
} else {
#ifdef DEBUG
Serial.println("Modem non connecte");
#endif
delay(1000);
}
}
void envoi()
{
int x;
Duree_cnx = millis() - Debut_cnx;
Debut_envoi1 = millis();
ThingSpeak.setField(1, Light_reset);
ThingSpeak.setField(2, Nbtent);
ThingSpeak.setField(3, Duree_cnx);
ThingSpeak.setField(4, Duree_envoi1);
ThingSpeak.setField(5, Vcc);
ThingSpeak.setField(6, mem_hard_reset);
// write to the ThingSpeak channel
x = ThingSpeak.writeFields(myChannelNumber1, myWriteAPIKey1);
if (x == 200) {
#ifdef DEBUG
Serial.println("Envoi 1 Channel update successful.");
#endif
}
else {
#ifdef DEBUG
Serial.println("Envoi 1 Problem updating channel. HTTP error code " + String(x));
#endif
}
#ifdef DEBUG
Serial.println();
#endif
Duree_envoi1 = millis() - Debut_envoi1;
Debut_envoi2 = millis();
Serial.println("111111111111111111");
ThingSpeak.setField(1, Light_reset);
ThingSpeak.setField(2, Nbtent);
ThingSpeak.setField(3, Duree_cnx);
ThingSpeak.setField(4, Duree_envoi2);
ThingSpeak.setField(5, Vcc);
ThingSpeak.setField(6, mem_hard_reset);
Serial.println("222222222222222222");
// write to the ThingSpeak channel
x = ThingSpeak.writeFields(myChannelNumber2, myWriteAPIKey2);
Serial.println("33333333333333333");
if (x == 200) {
#ifdef DEBUG
Serial.println("Envoi 2 Channel update successful.");
#endif
}
else {
#ifdef DEBUG
Serial.println("Envoi 2 Problem updating channel. HTTP error code " + String(x));
#endif
}
#ifdef DEBUG
Serial.println();
#endif
Duree_envoi2 = millis() - Debut_envoi2;
}
J'ai essayé de voir en mode debug (nbacess(1)), mais je ne suis pas trop familier avec les instructions AT
AT+USOCR=6
+USOCR: 0
OK
AT+USOCO=0,"api.thingspeak.com",80
OK
AT+USOWR=0,23,"504F5354202F75706461746520485454502F312E310D0A"
+USOWR: 0,23
OK
AT+USOWR=0,26,"486F73743A206170692E7468696E67737065616B2E636F6D0D0A"
+USOWR: 0,26
OK
AT+USOWR=0,12,"557365722D4167656E743A20"
+USOWR: 0,12
OK
AT+USOWR=0,34,"74736C69622D61726475696E6F2F322E302E30202861726475696E6F2073616D6429"
+USOWR: 0,34
OK
AT+USOWR=0,2,"0D0A"
+USOWR: 0,2
OK
AT+USOWR=0,20,"582D5448494E47535045414B4150494B45593A20"
+USOWR: 0,20
OK
AT+USOWR=0,16,"433258415039314D5A4C534833555256"
+USOWR: 0,16
OK
AT+USOWR=0,2,"0D0A"
+USOWR: 0,2
OK
AT+USOWR=0,49,"436F6E74656E742D547970653A206170706C69636174696F6E2F782D7777772D666F726D2D75726C656E636F6465640D0A"
+USOWR: 0,49
OK
AT+USOWR=0,16,"436F6E74656E742D4C656E6774683A20"
+USOWR: 0,16
OK
AT+USOWR=0,2,"3736"
+USOWR: 0,2
OK
AT+USOWR=0,4,"0D0A0D0A"
+USOWR: 0,4
OK
AT+USOWR=0,5,"6669656C64"
+USOWR: 0,5
OK
AT+USOWR=0,1,"31"
+USOWR: 0,1
OK
AT+USOWR=0,1,"3D"
+USOWR: 0,1
OK
AT+USOWR=0,1,"30"
+USOWR: 0,1
OK
AT+USOWR=0,1,"26"
+USOWR: 0,1
OK
AT+USOWR=0,5,"6669656C64"
+USOWR: 0,5
OK
AT+USOWR=0,1,"32"
+USOWR: 0,1
OK
AT+USOWR=0,1,"3D"
+USOWR: 0,1
OK
AT+USOWR=0,1,"30"
+USOWR: 0,1
OK
AT+USOWR=0,1,"26"
+USOWR: 0,1
OK
AT+USOWR=0,5,"6669656C64"
+USOWR: 0,5
OK
AT+USOWR=0,1,"33"
+USOWR: 0,1
OK
AT+USOWR=0,1,"3D"
+USOWR: 0,1
OK
AT+USOWR=0,4,"38323236"
+USOWR: 0,4
OK
AT+USOWR=0,1,"26"
+USOWR: 0,1
OK
AT+USOWR=0,5,"6669656C64"
+USOWR: 0,5
OK
AT+USOWR=0,1,"34"
+USOWR: 0,1
OK
AT+USOWR=0,1,"3D"
+USOWR: 0,1
OK
AT+USOWR=0,1,"30"
+USOWR: 0,1
OK
AT+USOWR=0,1,"26"
+USOWR: 0,1
OK
AT+USOWR=0,5,"6669656C64"
+USOWR: 0,5
OK
AT+USOWR=0,1,"35"
+USOWR: 0,1
OK
AT+USOWR=0,1,"3D"
+USOWR: 0,1
OK
AT+USOWR=0,7,"302E3033333630"
+USOWR: 0,7
OK
AT+USOWR=0,1,"26"
+USOWR: 0,1
OK
AT+USOWR=0,5,"6669656C64"
+USOWR: 0,5
OK
AT+USOWR=0,1,"36"
+USOWR: 0,1
OK
AT+USOWR=0,1,"3D"
+USOWR: 0,1
OK
AT+USOWR=0,1,"30"
+USOWR: 0,1
OK
AT+USOWR=0,14,"26686561646572733D66616C7365"
+USOWR: 0,14
OK
AT+USORD=0,512
+USORD: 0,""
OK
AT+USORD=0,512
+USORD: 0,""
OK
AT+USORD=0,512
+USORD: 0,""
OK
AT+USORD=0,512
+USORD: 0,""
OK
AT+USORD=0,512
+USORD: 0,""
OK
+UUSORD: 0,307
AT+USORD=0,512
+USORD: 0,307,"485454502F312E3120323030204F4B0D0A446174653A2053756E2C2031382053657020323032322032303A35373A323120474D540D0A436F6E74656E742D547970653A20746578742F68746D6C3B20636861727365743D7574662D380D0A436F6E74656E742D4C656E6774683A20340D0A436F6E6E656374696F6E3A2065663B876D760765741650572D3063622D6373206735534333783A33