Compilation qui se bloque pour ma station météo

Bonjour,
Très étrange ce qui m'arrive ce midi.

Après plusieurs heures de fonctionnement parfait, je modifie un peu le code et la compilation reste bloquée sans aucun message d'erreur.

Je charge un programme exemple RAS tout passe :frowning:

Je vous propose mon programme

#include <SPI.h>
#include <SD.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_BMP085_U.h>
#include <dht.h>
#include <DS1302.h>

const int chipSelect = 4;
Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);
dht DHT;
String nomfichier;
#define DHT22_PIN 9
const int kCePin = 5; // Chip Enable
const int kIoPin = 6; // Input/Output
const int kSclkPin = 7; // Serial Clock
DS1302 rtc(kCePin, kIoPin, kSclkPin);
String dayAsString(const Time::Day day) {
switch (day) {
case Time::kSunday: return "Sun";
case Time::kMonday: return "Mon";
case Time::kTuesday: return "Tue";
case Time::kWednesday: return "Wed";
case Time::kThursday: return "Thu";
case Time::kFriday: return "Fri";
case Time::kSaturday: return "Sat";
}
return "(unknown day)";
}
char buf[25];
/*struct
{
uint32_t total;
uint32_t ok;
uint32_t crc_error;
uint32_t time_out;
uint32_t connect;
uint32_t ack_l;
uint32_t ack_h;
uint32_t unknown;
} stat = { 0,0,0,0,0,0,0,0};
*/

void displaySensorDetails(void)
{
sensor_t sensor;
bmp.getSensor(&sensor);
Serial.println("------------------------------------");
Serial.print ("Sensor: "); Serial.println(sensor.name);
Serial.print ("Driver Ver: "); Serial.println(sensor.version);
Serial.print ("Unique ID: "); Serial.println(sensor.sensor_id);
Serial.print ("Max Value: "); Serial.print(sensor.max_value); Serial.println(" hPa");
Serial.print ("Min Value: "); Serial.print(sensor.min_value); Serial.println(" hPa");
Serial.print ("Resolution: "); Serial.print(sensor.resolution); Serial.println(" hPa");
Serial.println("------------------------------------");
Serial.println("");
delay(500);
}

void printTime() {

Time t = rtc.time();// Get the current time and date from the chip.
// Name the day of the week.
const String day = dayAsString(t.day);

// Format the time and date and insert into the temporary buffer.

snprintf(buf, sizeof(buf), "%s %04d-%02d-%02d %02d:%02d:%02d",
day.c_str(),
t.yr, t.mon, t.date,
t.hr, t.min, t.sec);
Serial.println("%04d-%02d.txt",t.yr,t.mon);

// Print the formatted string to serial so we can see the time.
//Serial.println(buf);
}

float temperature;
void setup()
{
Serial.begin(9600);
while (!Serial) {
;

Serial.println("dht22_test.ino");
Serial.print("LIBRARY VERSION: ");
Serial.println(DHT_LIB_VERSION);
Serial.println();
Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)\tTime (us)");
}

Serial.print("Initializing SD card...");

// see if the card is present and can be initialized:
if (!SD.begin(chipSelect)) {
Serial.println("Card failed, or not present");
// don't do anything more:
return;
}
Serial.println("card initialized.");
Serial.println("Pressure Sensor Test"); Serial.println("");
if(!bmp.begin())
{
/* There was a problem detecting the BMP085 ... check your connections */
Serial.print("Ooops, no BMP085 detected ... Check your wiring or I2C ADDR!");
while(1);
}
displaySensorDetails();
}

void loop()
{
// make a string for assembling the data to log:
String dataString = "";
sensors_event_t event;
bmp.getEvent(&event);

if (event.pressure)
{
dataString += buf;
dataString +=" ";
dataString += String(event.pressure);
dataString +=" ";
bmp.getTemperature(&temperature);
dataString += String(temperature);
dataString +=" ";
int chk = DHT.read22(DHT22_PIN);
dataString += String(DHT.humidity);

}
int i;
for (i=0; i<dataString.length();i++)
if (dataString_==0x2E) dataString*=0x2C;_
_
// open the file. note that only one file can be open at a time,_
_
// so you have to close this one before opening another._
_
//Serial.println("%04d-%02d.txt",t.yr,t.mon);_
File dataFile = SD.open("datalog.txt", FILE_WRITE);
_
// if the file is available, write to it:_
_
if (dataFile) {_
_
dataFile.println(dataString);_
_
dataFile.close();_
_
// print to the serial port too:_
_
Serial.println(dataString);_
_
}_
_
// if the file isn't open, pop up an error:_
_
else {_
_
Serial.println("error opening datalog.txt");_
_
}_
_
delay(920);_
_
}_
_
[/quote]_
Pour ce qui est des branchements, tout fonctionnait avant, je pense qu'il s'agit là d'un soucis logiciel.
Merci pour votre aide
Seul message dans la fenêtre compilation :
_
"Les options de compilation ont été modifiées, tout sera recompilé"*_
Et il tourne en boucle :frowning:

J'ai trouvé la ligne qui bloque :

Serial.println("%04d-%02d.txt",t.yr,t.mon);

Je veux affiche en préparation de sauvegarde dans un fichier du type "2015-07.txt" mais cela ne semble pas fonctionner :frowning:

qu'est ce qui ne va pas SVP ?

Bonjour,

je pense que tu dois faire au préalable un sprintf(....) pour concatener tes données.
Un exemple

static const byte BUFFER_SIZE = 12;
int annee, mois;

void setup() {
  Serial.begin(9600);
}

void loop() {
char journee[BUFFER_SIZE];
annee = 2015;
mois = 7;

sprintf(journee, "%3d-%2d.txt",annee,mois);
Serial.println(journee);
}

cela donnerait 2015- 7.txt dans le moniteur.

Merci, bon maintenant tout fonctionne.
Faut que je finisse la boite de protection extérieur et hop premier test sur plusieurs jours :wink: