IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Arduino Discussion :

Mon affichage disparait


Sujet :

Arduino

  1. #1
    Membre actif
    Inscrit en
    Juillet 2004
    Messages
    845
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 845
    Points : 239
    Points
    239
    Par défaut Mon affichage disparait
    Bonjour à tous

    Je poursuis mon projet d'affichage de la température piscine
    mais je me heurte à un petit souci
    pour mémoire , j'utilise Thingspeack pour "rapatrier" mes données de T° etc , mais j'utilise ici
    pour la mise à l'heure et autres données météos , les informations Métar ( Temp Ext , Humidité etc ..)

    Si par ailleurs je reçois correctement les données ( vu sur la console ) par contre l'affichage de la température
    apparait de façon aléatoire et je n'arrive pas à en connaître la raison
    je mets en copie le croquis actuel
    tout en précisant que j'utilise dans le croquis ci-dessous la librairie <ArduinoJson.h>
    1 fois pour les données MQTT
    1 fois pour les données METAR

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
     
    //***  ESP32-2432S028R *******//
     
     
    #include <SPI.h>
    #include <PubSubClient.h>
    #include <ArduinoJson.h>      // https://github.com/bblanchon/ArduinoJson
    #include <WiFi.h>
    #include "config.h"
    #include <TFT_eSPI.h>     // by Bodmer ver 2.5.34
    #include <NTPClient.h>    // by F.Weinberg ver 3.2.1
    #include <HTTPClient.h>   // by A.McEwen ver 2.2.0
     
     
     
    void WIFISetUp(void);
    void mqttCallback(char *topic, byte *payload, unsigned int length);
     
    ///////please enter your sensitive data in the Secret tab/arduino_secrets.h
    char ssid[] = WLAN_SSID;  // your network SSID (name)
    char password[] = WLAN_PASSWD;  // your network password (use for WPA, or use as key for WEP)
     
    const char* metar = "https://aviationweather.gov/api/data/metar?ids=LFLL&format=json"; // KDEN = ICAO code for Dever
    WiFiUDP ntpUDP;
    NTPClient timeClient(ntpUDP);
    int wifiTimeOutCounter = 0;
    #define TIMEOFFSET 3600 * 2  // no daylight saving time but 5h offset to UTC
     
    // definition for the screen
    #define MAX_Y 240
    #define MAX_X 320
    TFT_eSPI tft = TFT_eSPI();
    TFT_eSprite spr = TFT_eSprite(&tft);  // Déclarer l'objet Sprite "spr" avec un pointeur sur l'objet "tft".
    uint16_t palette[16] = { TFT_GREENYELLOW, TFT_NAVY, TFT_ORANGE, TFT_DARKCYAN, TFT_MAROON,
                             TFT_PURPLE, TFT_PINK, TFT_LIGHTGREY, TFT_YELLOW, TFT_BLUE,
                             TFT_GREEN, TFT_CYAN, TFT_RED, TFT_MAGENTA, TFT_BLUE, TFT_WHITE };
     
     
    WiFiClient wifiClient;
    PubSubClient mqttClient(wifiClient);
     
    // update parameter for the weather data
    unsigned long previousMillis = 0;
    #define INTERVAL 60000 * 5   // 5 min
     
     
    // init parameter for iniversum simulation
    int const n = 5, m = 200;
    float const r = 0.1;
    float x = 0, v = 0, t = 0;
     
    const char mqttBroker[] = "mqtt3.thingspeak.com";
    int mqttPort = 1883;
    const char mqttTopic[] = "channels/2499901/subscribe";
     
    const char mqttClientID[] = MQTT_CLIENT;
    const char mqttUsername[] = MQTT_USER;
    const char mqttPassword[] = MQTT_PASSWORD;
     
     
    byte omm = 99, oss = 99;
    byte xcolon = 0, xsecs = 0;
    unsigned int colour = 0;
     
    // set global variables for the weather informations
    int temperature = 0;  // °C
    int dew_point = 0;    // °C
    int wind_speed_knots = 0;
    int pressure = 0;           // hPa
    int relative_humidity = 0;  // %
    int wind_speed_kmh = 0;
    int data_age_min = 0;
    unsigned long epochTime = 0;
    unsigned long obsTime = 0;
     
    const char* piscine;
    const char* TempExt;
    const char* HumExt;
    const char* Bat;
     
    //*********************************************
    //  SETUP
    //*********************************************
    void setup() {
     
      Serial.begin(115200);
      while (!Serial) delay(10);
      Serial.println("Booting...");
     
      // print debugg infos an serial
      uint32_t chipId = 0;
      for (int i = 0; i < 17; i = i + 8) chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
      Serial.printf("ESP32 Chip model = %s Rev %d\n", ESP.getChipModel(), ESP.getChipRevision());
      Serial.printf("This chip has %d cores\n", ESP.getChipCores());
      Serial.print("Chip ID: ");
      Serial.println(chipId);
      Serial.print("Connecting to ");
      Serial.print(ssid);
      Serial.print(" ");
     
       // connect to router
      WiFi.begin(ssid, password);
      while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
        wifiTimeOutCounter++;
        if (wifiTimeOutCounter >= 60) ESP.restart();
      }
     
      Serial.println("");
      Serial.println("WiFi connected.");
      Serial.print("IP address: ");
      Serial.println(WiFi.localIP());
      uint8_t mac[6];
      WiFi.macAddress(mac);
      Serial.print("MAC address: ");
      for (int i = 0; i < 6; i++) {
        Serial.print(mac[i], HEX);
        if (i < 5) Serial.print(":");
      }
      Serial.println("");
      // Convert MAC address to unique identifier (UID)
      uint64_t uid = ((uint64_t)mac[0] << 40) | ((uint64_t)mac[1] << 32) | ((uint64_t)mac[2] << 24) | ((uint64_t)mac[3] << 16) | ((uint64_t)mac[4] << 8) | ((uint64_t)mac[5]);
      Serial.print("MAC unique identifier: ");
      Serial.println(uid);
      // init time system
      timeClient.begin();
      timeClient.setTimeOffset(TIMEOFFSET);
      // Init ttf
      tft.init();
      spr.setColorDepth(4);
      spr.createSprite(MAX_X, MAX_Y);
      tft.setRotation(1);
      // load first data to start with
      timeClient.update();
      weatherData();
     
      mqttClient.setServer(mqttBroker, mqttPort);
      mqttClient.setCallback(mqttCallback);
      mqttClient.setBufferSize(512);
     
      while (!mqttClient.connected()) {
        Serial.print("Tentative de connexion au MQTT broker: ");
        Serial.println(mqttBroker);
        if (mqttClient.connect(mqttClientID, mqttUsername, mqttPassword)) {
          Serial.println("Vous êtes connecté au MQTT broker!");
          if (mqttClient.subscribe(mqttTopic)) {
            Serial.print("S'abonner au topic ");
            Serial.print(mqttTopic);
            Serial.println(": succès");
            Serial.println("En attente de messages ...");
          } else {
            Serial.println("L'abonnement au Topic a échoué");
          }
        } else {
          Serial.print("Failed, state=");
          Serial.print(mqttClient.state());
          Serial.println(" Nouvel essai en 5s...");
          delay(5000);
        }
      }
    }
     
    //*********************************************
    //  LOOP
    //********************************************* 
    void loop() {
      spr.fillSprite(0);  // init sprite 
      // dessiner une simulation d'univers 
       for (int i = 0; i <= n; i++)
        for (int j = 0; j <= m; j++) {
          float u = sin(i + v) + sin(r * i + x);
          v = cos(i + v) + cos(r * i + x);
          x = u + t;
          int px = u * MAX_X / 4 + MAX_X / 2;
          int py = v * MAX_Y / 4 + MAX_Y / 2;
          uint16_t color = (i * 255) % 16;
          for (int dx = 0; dx <= 1; ++dx)
            for (int dy = 0; dy <= 1; ++dy)
              spr.drawPixel(px + dx, py + dy, color);
        }
      t += 0.01;
     
      // update weather information
      /*
      unsigned long currentMillis = millis();
      if (currentMillis - previousMillis > INTERVAL) {
        previousMillis = currentMillis;
        weatherData();
      }	
      */
     
      // Print everything
      spr.setTextColor(3);
      timeClient.update();
      String strtmp = timeClient.getFormattedTime() + "  " + getFormattedDate();
      spr.drawLine(0, 25, 319, 25,TFT_LIGHTGREY);
     
      if (timeClient.isTimeSet()) {
        spr.drawString(timeClient.getFormattedTime(), 5, 0, 4);
        spr.drawString(getFormattedDate(), 185, 0, 4);
     
        spr.drawString(String(piscine), 25, 80, 8);
        spr.drawString(" C", 280, 80, 4);
        spr.drawString(String(Bat), 250, 200, 4);
        spr.drawString(" %", 280, 200, 4);
     
        spr.pushSprite(0, 0);
      }
      mqttClient.loop();  // <===========================
    }
     
    //****se connecter au serveur météorologique et obtenir des données **************** 
    void weatherData() {
      if (WiFi.status() == WL_CONNECTED) {
        HTTPClient http;
        http.begin(metar);
        Serial.print("Sending HTTP request to: ");
        Serial.println(metar);
        int httpCode = http.GET();            // Send HTTP GET request
        if (httpCode > 0) {                   // Check if the request was successful
          DynamicJsonDocument metardoc(2048);      // Create JSON document (adjust the size accordingly)
          String payload1 = http.getString();  // Retrieve response from the website
          Serial.print("Response received: ");
          Serial.println(payload1);                                     // Output METAR data to the Serial Console
          DeserializationError error = deserializeJson(metardoc, payload1);  // Parse JSON data
          if (!error) {
            // start extractun weather data and update global variables
            temperature =metardoc[0]["temp"];
            dew_point = metardoc[0]["dewp"];
            wind_speed_knots =metardoc[0]["wspd"];
            pressure = metardoc[0]["altim"];
            obsTime = metardoc[0]["obsTime"];
            relative_humidity = 100 * expf(17.625f * dew_point / (243.04f + dew_point)) / expf(17.625f * temperature / (243.04f + temperature));
            wind_speed_kmh = wind_speed_knots * 1.852f;
            epochTime = timeClient.getEpochTime() - TIMEOFFSET;
            data_age_min = (epochTime - obsTime) / 60;
            // show most importand data on serial
            /*
            Serial.print("Temperature: ");
            Serial.print(temperature, 0);
            Serial.println();
            Serial.print("Relative Humidity: ");
            Serial.print(relative_humidity, 0);
            Serial.println("%");
            Serial.print("Wind Speed: ");
            Serial.print(wind_speed_kmh, 0);
            Serial.println("km/h");
            Serial.print("Pressure: ");
            Serial.print(pressure, 0);
            Serial.println("hPa");
            Serial.print("Data age: ");
            Serial.print((epochTime - obsTime) / 60);
            Serial.println("min");
            */
          } else Serial.println("Erreur d'analyse des données JSON");
        } else Serial.println("Erreur dans la récupération des données METAR");
        http.end();
      }
    }
     
     
    //******** ******************************************************* 
     
    String getFormattedDate() {
    #define LEAP_YEAR(Y) ((Y > 0) && !(Y % 4) && ((Y % 100) || !(Y % 400)))
      unsigned long rawTime = timeClient.getEpochTime() / 86400L;
      unsigned long days = 0, year = 1970;
      uint8_t month;
      static const uint8_t monthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
      while ((days += (LEAP_YEAR(year) ? 366 : 365)) <= rawTime) year++;
      rawTime -= days - (LEAP_YEAR(year) ? 366 : 365);
      for (month = 0; month < 12; month++) {
        uint8_t monthLength;
        if (month == 1) monthLength = LEAP_YEAR(year) ? 29 : 28;
        else monthLength = monthDays[month];
        if (rawTime < monthLength) break;
        rawTime -= monthLength;
      }
      String monthStr = ++month < 10 ? "0" + String(month) : String(month);
      String dayStr = ++rawTime < 10 ? "0" + String(rawTime) : String(rawTime);
      return String(dayStr) + "-" + monthStr + "-" + year;
    }
     
     
    //*************************************************************** 
    void mqttCallback(char *topic, byte *payload, unsigned int length) {
      Serial.print("Message arrivé du topic: ");
      Serial.println(topic);
      Serial.print("Message:");
      for (int i = 0; i < length; i++) {
        Serial.print((char)payload[i]);
      }
      Serial.println();
      Serial.println("-----------------------");
     
      JsonDocument doc;
      deserializeJson(doc, (unsigned char*)payload);
     
      piscine = doc["field4"];
      Serial.print("T° piscine = ");
      Serial.println(piscine);
     
      TempExt = doc["field1"];
      Serial.print("T° Exterieur = ");
      Serial.println(TempExt);
     
      HumExt = doc["field2"];
      Serial.print("Humidité Exterieure = ");
      Serial.println(HumExt);
     
      Bat = doc["field3"];
      Serial.print("Batterie = ");
      Serial.println(Bat);
     
    }
    Enfin , je mets :
    image 1 : ce que je devrais avoir
    image 2 : ce que j'ai lorsque par moment

    merci avance
    pascal
    Images attachées Images attachées   

  2. #2
    Membre actif
    Inscrit en
    Juillet 2004
    Messages
    845
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 845
    Points : 239
    Points
    239
    Par défaut
    Bonjour à tous

    J'ai, semble-t-il, résolu mon petit problème
    mais je souhaiterai votre avis

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
    /*
    const char* piscine;
    const char* TempExt;
    const char* HumExt;
    const char* Bat;
    */
     
    float piscine = 0;
    int TempExt = 0;
    int HumExt = 0;
    int Bat = 0;
    j'ai changé le type des variables et j'arrive à afficher les données sans perte
    mais je ne suis pas sûr du tout d'avoir fait la bonne démarche
    je remets le croquis définitif et attends vos conseils


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    325
    326
     
    #include <SPI.h>
    #include <PubSubClient.h>
    #include <ArduinoJson.h>      // https://github.com/bblanchon/ArduinoJson
    #include <WiFi.h>
    #include "config.h"
    #include <TFT_eSPI.h>     // by Bodmer ver 2.5.34
    #include <NTPClient.h>    // by F.Weinberg ver 3.2.1
    #include <HTTPClient.h>   // by A.McEwen ver 2.2.0
     
     
     
    void WIFISetUp(void);
    void mqttCallback(char *topic, byte *payload, unsigned int length);
     
    ///////please enter your sensitive data in the Secret tab/arduino_secrets.h
    char ssid[] = WLAN_SSID;  // your network SSID (name)
    char password[] = WLAN_PASSWD;  // your network password (use for WPA, or use as key for WEP)
     
    const char* metar = "https://aviationweather.gov/api/data/metar?ids=LFLL&format=json"; // KDEN = ICAO code for Dever
    WiFiUDP ntpUDP;
    NTPClient timeClient(ntpUDP);
    int wifiTimeOutCounter = 0;
    #define TIMEOFFSET 3600 * 2  // no daylight saving time but 5h offset to UTC
     
    // definition for the screen
    #define MAX_Y 240
    #define MAX_X 320
    TFT_eSPI tft = TFT_eSPI();
    TFT_eSprite spr = TFT_eSprite(&tft);  // Déclarer l'objet Sprite "spr" avec un pointeur sur l'objet "tft".
    uint16_t palette[16] = { TFT_GREENYELLOW, TFT_NAVY, TFT_ORANGE, TFT_DARKCYAN, TFT_MAROON,
                             TFT_PURPLE, TFT_PINK, TFT_LIGHTGREY, TFT_YELLOW, TFT_BLUE,
                             TFT_GREEN, TFT_CYAN, TFT_RED, TFT_MAGENTA, TFT_BLUE, TFT_WHITE };
     
     
    WiFiClient wifiClient;
    PubSubClient mqttClient(wifiClient);
     
    // update parameter for the weather data
    unsigned long previousMillis = 0;
    #define INTERVAL 60000 * 5   // 5 min
     
     
    // init parameter for iniversum simulation
    int const n = 5, m = 200;
    float const r = 0.1;
    float x = 0, v = 0, t = 0;
     
    const char mqttBroker[] = "mqtt3.thingspeak.com";
    int mqttPort = 1883;
    const char mqttTopic[] = "channels/2499901/subscribe";
     
    const char mqttClientID[] = MQTT_CLIENT;
    const char mqttUsername[] = MQTT_USER;
    const char mqttPassword[] = MQTT_PASSWORD;
     
     
    byte omm = 99, oss = 99;
    byte xcolon = 0, xsecs = 0;
    unsigned int colour = 0;
     
    // set global variables for the weather informations
    int temperature = 0;  // °C
    int dew_point = 0;    // °C
    int wind_speed_knots = 0;
    int pressure = 0;           // hPa
    int relative_humidity = 0;  // %
    int wind_speed_kmh = 0;
    int data_age_min = 0;
    unsigned long epochTime = 0;
    unsigned long obsTime = 0;
     
    /*
    const char* piscine;
    const char* TempExt;
    const char* HumExt;
    const char* Bat;
    */
     
    float piscine = 0;  //<=================
    int TempExt = 0; //<=================
    int HumExt = 0;  //<=================
    int Bat = 0;       //<=================
     
    //*********************************************
    //  SETUP
    //*********************************************
    void setup() {
     
      Serial.begin(115200);
      while (!Serial) delay(10);
      Serial.println("Booting...");
     
      // print debugg infos an serial
      uint32_t chipId = 0;
      for (int i = 0; i < 17; i = i + 8) chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
      Serial.printf("ESP32 Chip model = %s Rev %d\n", ESP.getChipModel(), ESP.getChipRevision());
      Serial.printf("This chip has %d cores\n", ESP.getChipCores());
      Serial.print("Chip ID: ");
      Serial.println(chipId);
      Serial.print("Connecting to ");
      Serial.print(ssid);
      Serial.print(" ");
     
       // connect to router
      WiFi.begin(ssid, password);
      while (WiFi.status() != WL_CONNECTED) {
        delay(500);
        Serial.print(".");
        wifiTimeOutCounter++;
        if (wifiTimeOutCounter >= 60) ESP.restart();
      }
     
      Serial.println("");
      Serial.println("WiFi connected.");
      Serial.print("IP address: ");
      Serial.println(WiFi.localIP());
      uint8_t mac[6];
      WiFi.macAddress(mac);
      Serial.print("MAC address: ");
      for (int i = 0; i < 6; i++) {
        Serial.print(mac[i], HEX);
        if (i < 5) Serial.print(":");
      }
      Serial.println("");
      // Convert MAC address to unique identifier (UID)
      uint64_t uid = ((uint64_t)mac[0] << 40) | ((uint64_t)mac[1] << 32) | ((uint64_t)mac[2] << 24) | ((uint64_t)mac[3] << 16) | ((uint64_t)mac[4] << 8) | ((uint64_t)mac[5]);
      Serial.print("MAC unique identifier: ");
      Serial.println(uid);
      // init time system
      timeClient.begin();
      timeClient.setTimeOffset(TIMEOFFSET);
      // Init ttf
      tft.init();
      spr.setColorDepth(4);
      spr.createSprite(MAX_X, MAX_Y);
      tft.setRotation(1);
      // load first data to start with
      timeClient.update();
      weatherData();
     
      mqttClient.setServer(mqttBroker, mqttPort);
      mqttClient.setCallback(mqttCallback);
      mqttClient.setBufferSize(512);
     
      while (!mqttClient.connected()) {
        Serial.print("Tentative de connexion au MQTT broker: ");
        Serial.println(mqttBroker);
        if (mqttClient.connect(mqttClientID, mqttUsername, mqttPassword)) {
          Serial.println("Vous êtes connecté au MQTT broker!");
          if (mqttClient.subscribe(mqttTopic)) {
            Serial.print("S'abonner au topic ");
            Serial.print(mqttTopic);
            Serial.println(": succès");
            Serial.println("En attente de messages ...");
          } else {
            Serial.println("L'abonnement au Topic a échoué");
          }
        } else {
          Serial.print("Failed, state=");
          Serial.print(mqttClient.state());
          Serial.println(" Nouvel essai en 5s...");
          delay(5000);
        }
      }
    }
     
    //*********************************************
    //  LOOP
    //********************************************* 
    void loop() {
      spr.fillSprite(0);  // init sprite 
     
      // dessiner une simulation d'univers dans un sprite vide
     
       for (int i = 0; i <= n; i++)
        for (int j = 0; j <= m; j++) {
          float u = sin(i + v) + sin(r * i + x);
          v = cos(i + v) + cos(r * i + x);
          x = u + t;
          int px = u * MAX_X / 4 + MAX_X / 2;
          int py = v * MAX_Y / 4 + MAX_Y / 2;
          uint16_t color = (i * 255) % 16;
          for (int dx = 0; dx <= 1; ++dx)
            for (int dy = 0; dy <= 1; ++dy)
              spr.drawPixel(px + dx, py + dy, color);
        }
     
      t += 0.01;
     
      // update weather information
      /*
      unsigned long currentMillis = millis();
      if (currentMillis - previousMillis > INTERVAL) {
        previousMillis = currentMillis;
        weatherData();
      }	
      */
     
      // Print everything
      spr.setTextColor(3);
      timeClient.update();
      String strtmp = timeClient.getFormattedTime() + "  " + getFormattedDate();
      spr.drawLine(0, 25, 319, 25,TFT_LIGHTGREY);
     
      if (timeClient.isTimeSet()) {
        spr.drawString(timeClient.getFormattedTime(), 5, 0, 4);
        spr.drawString(getFormattedDate(), 185, 0, 4);
        spr.setTextColor(5); // 3 =
        spr.drawString("C",280,70,4);
        spr.drawString(String(piscine,2), 35, 80, 8);
        spr.setTextColor(6);
        String outputString ="";
        outputString = "T Ext.: "+String(TempExt) + "c    " + "H Ext.: "+String(HumExt) + "%           " +"Batterie : "+ String(Bat) + "%";
        if (data_age_min < 70) spr.drawString(outputString, 0, 200, 2);
        // push sprite (update screen)
        spr.pushSprite(0, 0);
      }
      mqttClient.loop(); 
    }    
     
    //****se connecter au serveur météorologique et obtenir des données **************** 
    void weatherData() {
      if (WiFi.status() == WL_CONNECTED) {
        HTTPClient http;
        http.begin(metar);
        Serial.print("Sending HTTP request to: ");
        Serial.println(metar);
        int httpCode = http.GET();            // Send HTTP GET request
        if (httpCode > 0) {                   // Check if the request was successful
          DynamicJsonDocument metardoc(2048);      // Create JSON document (adjust the size accordingly)
          String payload = http.getString();  // Retrieve response from the website
          Serial.print("Response received: ");
          Serial.println(payload);                                     // Output METAR data to the Serial Console
          DeserializationError error = deserializeJson(metardoc, payload);  // Parse JSON data
          if (!error) {
            // start extractun weather data and update global variables
            temperature =metardoc[0]["temp"];
            dew_point = metardoc[0]["dewp"];
            wind_speed_knots =metardoc[0]["wspd"];
            pressure = metardoc[0]["altim"];
            obsTime = metardoc[0]["obsTime"];
            relative_humidity = 100 * expf(17.625f * dew_point / (243.04f + dew_point)) / expf(17.625f * temperature / (243.04f + temperature));
            wind_speed_kmh = wind_speed_knots * 1.852f;
            epochTime = timeClient.getEpochTime() - TIMEOFFSET;
            data_age_min = (epochTime - obsTime) / 60;
            // show most importand data on serial
            /*
            Serial.print("Temperature: ");
            Serial.print(temperature, 0);
            Serial.println();
            Serial.print("Relative Humidity: ");
            Serial.print(relative_humidity, 0);
            Serial.println("%");
            Serial.print("Wind Speed: ");
            Serial.print(wind_speed_kmh, 0);
            Serial.println("km/h");
            Serial.print("Pressure: ");
            Serial.print(pressure, 0);
            Serial.println("hPa");
            Serial.print("Data age: ");
            Serial.print((epochTime - obsTime) / 60);
            Serial.println("min");
            */
          } else Serial.println("Erreur d'analyse des données JSON");
        } else Serial.println("Erreur dans la récupération des données METAR");
        http.end();
      }
    }
     
     
    //********this is missing in the library ******************************************************* 
     
    String getFormattedDate() {
    #define LEAP_YEAR(Y) ((Y > 0) && !(Y % 4) && ((Y % 100) || !(Y % 400)))
      unsigned long rawTime = timeClient.getEpochTime() / 86400L;
      unsigned long days = 0, year = 1970;
      uint8_t month;
      static const uint8_t monthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
      while ((days += (LEAP_YEAR(year) ? 366 : 365)) <= rawTime) year++;
      rawTime -= days - (LEAP_YEAR(year) ? 366 : 365);
      for (month = 0; month < 12; month++) {
        uint8_t monthLength;
        if (month == 1) monthLength = LEAP_YEAR(year) ? 29 : 28;
        else monthLength = monthDays[month];
        if (rawTime < monthLength) break;
        rawTime -= monthLength;
      }
      String monthStr = ++month < 10 ? "0" + String(month) : String(month);
      String dayStr = ++rawTime < 10 ? "0" + String(rawTime) : String(rawTime);
      return String(dayStr) + "-" + monthStr + "-" + year;
    }
     
     
    //*************************************************************** 
    void mqttCallback(char *topic, byte *payload, unsigned int length) {
      Serial.print("Message arrivé du topic: ");
      Serial.println(topic);
      Serial.print("Message:");
      for (int i = 0; i < length; i++) {
        Serial.print((char)payload[i]);
      }
      Serial.println();
      Serial.println("-----------------------");
     
      JsonDocument doc;
      deserializeJson(doc, (unsigned char*)payload);
     
      piscine = doc["field4"];
      Serial.print("T° piscine = ");
      Serial.println(piscine);
     
      TempExt = doc["field1"];
      Serial.print("T° Exterieur = ");
      Serial.println(TempExt,0);
     
      HumExt = doc["field2"];
      Serial.print("Humidité Exterieure = ");
      Serial.println(HumExt,0);
     
      Bat = doc["field3"];
      Serial.print("Batterie = ");
      Serial.println(Bat,0);
     
     
    }

  3. #3
    Membre actif
    Inscrit en
    Juillet 2004
    Messages
    845
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 845
    Points : 239
    Points
    239
    Par défaut
    Bonjour à tous ,

    Mon petit problème est situé dans le modèle de conversion Char to String

    j'ai voulu ajouter une date de mise à jour des données affichées
    cette "date" est un champ caractère appelé

    sous la forme ex : "2024-08-19T10:43:50Z"


    je souhaite tout simplement l'afficher sur l'écran :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    String Value = MAJ;
        outputString = "Maj le : "+ Value;
        spr.setTextColor(6); 
        spr.drawString(outputString, 0, 220, 2);
    le résultat est que l'écran affiche des signes "cabalistiques" puis après un certain temps affiche la valeur de MAJ
    il semblerait donc comme précédemment j'ai des difficultés à convertir mon champ MAJ en string()

  4. #4
    Membre expérimenté Avatar de edgarjacobs
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2011
    Messages
    661
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 64
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Mai 2011
    Messages : 661
    Points : 1 689
    Points
    1 689
    Par défaut
    Hello,

    Comment remplis-tu MAJ ? Car tel que tu le codes, MAJ ne peut pas recevoir quoi que ce soit: MAJ à une taille de zéro caractère.

    Et si tu fais ceci
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    char maj[24];
    ....
    strncpy(maj, "2024-08-19T10:43:50Z", sizeof(maj));
    maj[sizeof(maj)-1]=0;
    ....
    String value=maj;
    // etc
    le résultat n'est-il pas meilleur ?

    Edit: la ligne 4 peut surprendre, mais il est écrit
    No null-character is implicitly appended at the end of destination if source is longer than num. Thus, in this case, destination shall not be considered a null terminated C string (reading it as such would overflow).
    dans la description de strncpy(). Bon, dans l'exemple que je donne, ce n'est pas le cas, mais je pense que c'est une bonne habitude de faire cela. Ça pourra éviter des emm.... par la suite.
    On écrit "J'ai tort" ; "tord" est la conjugaison du verbre "tordre" à la 3ème personne de l'indicatif présent

  5. #5
    Membre actif
    Inscrit en
    Juillet 2004
    Messages
    845
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 845
    Points : 239
    Points
    239
    Par défaut
    Salut edgarjacobs

    je suis malheureusement toujours en galère , je ne pige pas le principe
    erreur :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Compilation error: conversion from 'char* [24]' to non-scalar type 'String' requested

    pour mémoire j'ai déclaré ceci :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    char Miseajour[24];
    ensuite de désérialise ici :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
    //*************************************************************** 
    void mqttCallback(char *topic, byte *payload, unsigned int length) {
      Serial.print("Message arrivé du topic: ");
      Serial.println(topic);
      Serial.print("Message:");
      for (int i = 0; i < length; i++) {
        Serial.print((char)payload[i]);
      }
      Serial.println();
      Serial.println("-----------------------");
     
      JsonDocument doc;
      deserializeJson(doc, (unsigned char*)payload);
     
      piscine = doc["field4"];
      Serial.print("T° piscine = ");
      Serial.println(piscine);
     
      TempExt = doc["field1"];
      Serial.print("T° Exterieur = ");
      Serial.println(TempExt,0);
     
      HumExt = doc["field2"];
      Serial.print("Humidité Exterieure = ");
      Serial.println(HumExt,0);
     
      Bat = doc["field3"];
      Serial.print("Batterie = ");
      Serial.println(Bat,0);
     
     
      const char* (maj) = doc["created_at"];   //<==================================
      Serial.print("Mise à jour le  ");                // <==================================
      Serial.println(maj);                               // <==================================
      strcpy(Miseajour, maj);                        // <==================================
     
     
    }

    puis j'essaie d'afficher le contenu de "maj" ici

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    ....
    spr.setTextColor(6); 
        outputString ="";
        String value = Miseajour;
        outputString = "Maj le : "+ value;
        spr.drawString(outputString, 0, 220, 2);
        spr.pushSprite(0, 0);
    .....
    J'utilise 2 variables car l'une est affichée avec Serial.println(maj); et l'autre par spr.drawString()
    mais ce n'est pas la bonne méthode on dirait ...

  6. #6
    Expert confirmé

    Homme Profil pro
    mad scientist :)
    Inscrit en
    Septembre 2019
    Messages
    2 817
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Etats-Unis

    Informations professionnelles :
    Activité : mad scientist :)

    Informations forums :
    Inscription : Septembre 2019
    Messages : 2 817
    Points : 5 674
    Points
    5 674
    Par défaut
    Citation Envoyé par edgarjacobs Voir le message
    Edit: la ligne 4 peut surprendre, mais il est écrit

    dans la description de strncpy(). Bon, dans l'exemple que je donne, ce n'est pas le cas, mais je pense que c'est une bonne habitude de faire cela. Ça pourra éviter des emm.... par la suite.
    oui c'est effectivement une bonne pratique avec strncpy().

    L'autre solution est d'utiliser strlcpy() au lieu de strncpy(), la version avec le `l` garantit qu'un caractère nul sera mis à la fin.

  7. #7
    Membre actif
    Inscrit en
    Juillet 2004
    Messages
    845
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 845
    Points : 239
    Points
    239
    Par défaut
    Bonjour à tous ,

    Voici ce que j'ai programmé ( merci encore pour votre aide précieuse ) :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
     
    char Miseajour[24]; 
    .....
     
    void mqttCallback(char *topic, byte *payload, unsigned int length) {
      Serial.print("Message arrivé du topic: ");
      Serial.println(topic);
      Serial.print("Message:");
      for (int i = 0; i < length; i++) {
        Serial.print((char)payload[i]);
      }
      Serial.println();
      Serial.println("-----------------------");
     
      JsonDocument doc;
      deserializeJson(doc, (unsigned char*)payload);
     
       ........
     
      const char* (maj) = doc["created_at"];
      Serial.print("Mise à jour le  ");
      Serial.println(maj);
      //strcpy(Miseajour, maj);
      strncpy(Miseajour, maj, sizeof(Miseajour));
      Miseajour[sizeof(Miseajour)-1]=0;
     
    } 
     
    ......
     
     
    void loop() {
     
        ......    
        spr.setTextColor(6); 
        outputString ="";
        String value = Miseajour;
        outputString = "Maj le : "+ value;
        spr.drawString(outputString, 0, 220, 2);
        spr.pushSprite(0, 0);
     
      ..............
     
    }
    Est-ce correct ?çà fonctionne désormais,
    J'aurai si vous le permettez 2 questions complémentaires pour solder ce projet

    1)
    la variable 'Miseajour' est sous la forme ex : "2024-08-19T10:43:50Z"
    soit donc la date et l'heure d'envoi de ThingSpeack , or l'heure est au format UTC et non locale (+2h)
    ex du format reçu :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    essage:{"channel_id":xxxxxxx,"created_at":"2024-08-20T09:24:34Z","entry_id":33793,"field1":"29.50","field2":"48.00","field3":"72","field4":"27.69","field5":null,"field6":null,"field7":null,"field8":null,"latitude":null,"longitude":null,"elevation":null,"status":null}
    Question : Comment faire pour ajouter au format actuel +2h

    2) utilisation de DrawString() (affichage des données sur TFT )
    j'ai longtemps galéré ( vois le titre du post) pour comprendre que
    le format const char* () pour les variables à afficher était incompatible avec DrawSpring()
    en définitive, pour les affichages de données numériques, je suis donc passé par une déclaration int() pour contourner le problème
    mais pour le format des caractères ( ex MiseaJour ) , nous sommes obligés de passer par Miseajour[24]
    pourquoi svp ?

  8. #8
    Membre expérimenté Avatar de edgarjacobs
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Mai 2011
    Messages
    661
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 64
    Localisation : Belgique

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Mai 2011
    Messages : 661
    Points : 1 689
    Points
    1 689
    Par défaut
    Question : Comment faire pour ajouter au format actuel +2h
    Ajouter 2h est un poil plus compliqué qu'il n'y parait. Avec la valeur montrée, pas de problème, mais quid de l'ajour de deux heures le "2024-12-31T23:47:30Z" ? Ou en fin de mois d'une manière générale ?

    Je supprime le code, je ne trouve pas l'erreur. Vraiment désolé.
    On écrit "J'ai tort" ; "tord" est la conjugaison du verbre "tordre" à la 3ème personne de l'indicatif présent

  9. #9
    Membre actif
    Inscrit en
    Juillet 2004
    Messages
    845
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 845
    Points : 239
    Points
    239
    Par défaut
    Ok
    merci beaucoup edgarjacobs
    je teste .....

    pascal

    PS: si je ne voulais changer que l'heure dans la chaîne de caractères comme ici par ex :"2024-12-31T23:43:50Z"
    je devrais faire comment ?

  10. #10
    Membre expérimenté
    Femme Profil pro
    ..
    Inscrit en
    Décembre 2019
    Messages
    667
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 94
    Localisation : Autre

    Informations professionnelles :
    Activité : ..

    Informations forums :
    Inscription : Décembre 2019
    Messages : 667
    Points : 1 462
    Points
    1 462
    Par défaut
    Salut,

    As-tu pensé à faire une recherche: thingspeak timezone ? De ce que je vois, ce n'est pas les réponses qui manquent. Ou peut-être, aucune ne te convient ?

  11. #11
    Responsable Arduino et Systèmes Embarqués


    Avatar de f-leb
    Homme Profil pro
    Enseignant
    Inscrit en
    Janvier 2009
    Messages
    12 766
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Sarthe (Pays de la Loire)

    Informations professionnelles :
    Activité : Enseignant

    Informations forums :
    Inscription : Janvier 2009
    Messages : 12 766
    Points : 58 089
    Points
    58 089
    Billets dans le blog
    42
    Par défaut
    Hi,

    Citation Envoyé par kaitlyn Voir le message
    Salut,

    As-tu pensé à faire une recherche: thingspeak timezone ? De ce que je vois, ce n'est pas les réponses qui manquent. Ou peut-être, aucune ne te convient ?
    Sur le profil Thingspeak (menu My Profile), il y a bien un champ Timezone. Il s'en sert pour afficher l'heure locale sur les graphiques, mais je ne suis pas sûr pour autant qu'il renvoie des données à l'heure locale. A vérifier...

  12. #12
    Membre expérimenté
    Femme Profil pro
    ..
    Inscrit en
    Décembre 2019
    Messages
    667
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 94
    Localisation : Autre

    Informations professionnelles :
    Activité : ..

    Informations forums :
    Inscription : Décembre 2019
    Messages : 667
    Points : 1 462
    Points
    1 462
    Par défaut
    re,

    Je ne connais pas "thingspeak", mais dans les premiers liens on peut lire, entre autres, ceci :

    https://github.com/mathworks/thingspeak-arduino
    Timezones can be set using the timezone hour offset parameter. For example, a timestamp for Eastern Standard Time is: "2017-01-12 13:22:54-05". If no timezone hour offset parameter is used, UTC time is assumed.
    D'une manière ou dune autre, que l'heure locale ne soit pas prise en charge, surtout avec une date au format iso, ce serait juste invraisemblable.

  13. #13
    Membre actif
    Inscrit en
    Juillet 2004
    Messages
    845
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 845
    Points : 239
    Points
    239
    Par défaut
    Re...
    Bonsoir à tous

    kaitlyn
    As-tu pensé à faire une recherche: thingspeak timezone ? De ce que je vois, ce n'est pas les réponses qui manquent. Ou peut-être, aucune ne te convient ?
    f-leb
    Sur le profil Thingspeak (menu My Profile), il y a bien un champ Timezone. Il s'en sert pour afficher l'heure locale sur les graphiques, mais je ne suis pas sûr pour autant qu'il renvoie des données à l'heure locale. A vérifier...

    J'ai mis le profil le timezone ad'hoc , le tracé montre une heure correcte à +2 GMT mais lorsque je reçois l'heure dans le topic celle-ci est à GMT soit -2h


    Edit :
    J'ai posé la question sur Thingspeak

    voici les duex reponses reçues à ce jour

    1)
    "2024-08-21T16:54:31Z"
    The Z at the end of the timestamp specifically means "Zulu" time, which is UTC.
    It would be expected that times in that format would be converted to be in timezone UTC. To plot them in local time, you would need to change the TimeZone property of the data.

    2)
    To illustratte —
    TZ = timezones("Europe");
    disp(TZ)
    MessageTime = datetime("2024-08-21T16:54:31Z", 'InputFormat','yyyy-MM-dd''T''HH:mm:ssZ', 'TimeZone','Europe/Paris')

    (mais je ne vois comment introduire le message time ?

  14. #14
    Membre expérimenté
    Femme Profil pro
    ..
    Inscrit en
    Décembre 2019
    Messages
    667
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 94
    Localisation : Autre

    Informations professionnelles :
    Activité : ..

    Informations forums :
    Inscription : Décembre 2019
    Messages : 667
    Points : 1 462
    Points
    1 462
    Par défaut
    Et mon dernier message, il est transparent ???

    Sinon en remontant un peu dans ta discussion, je vois que tu fais des pirouettes avec ta donnée de mise à jour.
    Une classe String se contente aussi bien de const char* que de char[]. Si tu n'obtiens pas le résultat escompté, c'est que le problème est en amont.

    Tu peux essayer ceci par exemple :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    const char* data= "blablabla";
    String msg(data);
    ...drawstring(msg, ...
    Pour ta mise à jour :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    String maj(doc["update_at"]);
    ...

  15. #15
    Membre actif
    Inscrit en
    Juillet 2004
    Messages
    845
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 845
    Points : 239
    Points
    239
    Par défaut
    Et mon dernier message, il est transparent ???
    Non , non mais j'étais en train de le rédiger tout en cherchant des infos sur TimeZone (que je n'ai pas trouvé d'ailleurs) et
    j'ai oublié la mise à jour ...desolé

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    String maj(doc["update_at"]);
    là encore désolé mais "update_at" ne fait pas parti du topic , ( je ne sais pas pourquoi car il apparait bien dans les fichiers exports )
    mais j'avais tenté mais çà ne fonctionne pas

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    const char* data= "blablabla";
    String msg(data);
    ...drawstring(msg, ...
    je vais essayer de faire çà effectivement ...

  16. #16
    Membre expérimenté
    Femme Profil pro
    ..
    Inscrit en
    Décembre 2019
    Messages
    667
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 94
    Localisation : Autre

    Informations professionnelles :
    Activité : ..

    Informations forums :
    Inscription : Décembre 2019
    Messages : 667
    Points : 1 462
    Points
    1 462
    Par défaut
    Pour mon dernier message, avec le lien, je parle de celui-ci (pour qu'on soit bien d'accord) :

    Citation Envoyé par kaitlyn Voir le message
    re,

    Je ne connais pas "thingspeak", mais dans les premiers liens on peut lire, entre autres, ceci :

    https://github.com/mathworks/thingspeak-arduino
    Timezones can be set using the timezone hour offset parameter. For example, a timestamp for Eastern Standard Time is: "2017-01-12 13:22:54-05". If no timezone hour offset parameter is used, UTC time is assumed.
    D'une manière ou dune autre, que l'heure locale ne soit pas prise en charge, surtout avec une date au format iso, ce serait juste invraisemblable.
    Ensuite pour ta mise à jour, j'ai instinctivement traduit et en regardant ton code, c'est "created_at", donc finalement c'est String maj(doc["created_at"]);

Discussions similaires

  1. Comment inverser mon affichage (miroir horizontal)?
    Par mougel dans le forum Périphériques
    Réponses: 4
    Dernier message: 25/11/2007, 19h57
  2. Comment inverser mon affichage (miroir)?
    Par mougel dans le forum Développement 2D, 3D et Jeux
    Réponses: 2
    Dernier message: 24/11/2007, 15h38
  3. Réponses: 6
    Dernier message: 15/06/2007, 14h34
  4. comment connaitre le temps que met mon affichage graphique ?
    Par poulette3000 dans le forum AWT/Swing
    Réponses: 1
    Dernier message: 14/06/2007, 16h21
  5. [CSS] Mon texte ou mon image disparait sous IE.
    Par KneXtasY dans le forum Mise en page CSS
    Réponses: 6
    Dernier message: 05/12/2005, 17h59

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo