HTTPClient library problem

Hi guys, i was working on a project : sending data from esp32 to google spreadsheets and this error keep showing up : Erreur de compilation pour la carte ESP32 Dev Module
i installed the library HTTPClient and reinstalled it and it didn't resolve it, I'm really confused, this is my code it's working fine from the video where i got it :

#include <WiFi.h>
#include <HTTPClient.h>

#define ThermistorPin 35
#define LDR_PIN       34

#define R1  10000
#define C1  (float)1.009249522e-03
#define C2  (float)2.378405444e-04
#define C3  (float)2.019202697e-07

const char * ssid = "Orange-BFAA";
const char * password = "topnetbnh";

String GOOGLE_SCRIPT_ID = "AKfycbxuKP_ueeMTY0aheBAEZoqMkdacLYRUNuw7RKo7isd3OgTMaOvR0EM_AgMp88iBlqdx";


const int sendInterval = 5000;
float avg[3] = {0, 0, 0};

char light_array[7];
char temp_array[7];


const char * root_ca = \
                       "-----BEGIN CERTIFICATE-----\n" \
                       "MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4G\n" \
                       "A1UECxMXR2xvYmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNp\n" \
                       "Z24xEzARBgNVBAMTCkdsb2JhbFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1\n" \
                       "MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMjETMBEG\n" \
                       "A1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2lnbjCCASIwDQYJKoZI\n" \
                       "hvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6ErPL\n" \
                       "v4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8\n" \
                       "eoLrvozps6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklq\n" \
                       "tTleiDTsvHgMCJiEbKjNS7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzd\n" \
                       "C9XZzPnqJworc5HGnRusyMvo4KD0L5CLTfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pa\n" \
                       "zq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6CygPCm48CAwEAAaOBnDCB\n" \
                       "mTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUm+IH\n" \
                       "V2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5n\n" \
                       "bG9iYWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG\n" \
                       "3lm0mi3f3BmGLjANBgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4Gs\n" \
                       "J0/WwbgcQ3izDJr86iw8bmEbTUsp9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO\n" \
                       "291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu01yiPqFbQfXf5WRDLenVOavS\n" \
                       "ot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG79G+dwfCMNYxd\n" \
                       "AfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7\n" \
                       "TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==\n" \
                       "-----END CERTIFICATE-----\n";


WiFiClientSecure client;

void setup() {
  Serial.begin(115200);
  delay(10);

  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);

  Serial.println("Started");
  Serial.print("Connecting");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  Serial.println("Ready to go");
}


float getTemperature(void)
{
  static int avgArrayIndex = 0;
  int Vo;
  float logR2, R2, T, Tc;
  Vo = analogRead(ThermistorPin);
  R2 = R1 * (4096.0 / (float)Vo - 1.0);
  logR2 = log(R2);
  T = (1.0 / (C1 + C2 * logR2 + C3 * logR2 * logR2 * logR2));
  Tc = T - 273.15;
  avg[avgArrayIndex++] = Tc;
  if (avgArrayIndex > 2)
    avgArrayIndex = 0;
  Tc = (avg[0] + avg[1] + avg[2]) / 3;
  return Tc;
}

float getLightPercentage(void)
{
  int ldrRawVal;
  float percentage;
  ldrRawVal = analogRead(LDR_PIN);
  percentage = ((float)((ldrRawVal * 100) / 4096));
  return percentage;
}

void loop() {
  float lightpercentage = getLightPercentage();
  float temp = getTemperature();
  String temp_s(temp);
  String lightPer_s(lightpercentage);

  sendData("tag=adc_A0&value=" + lightPer_s);
  delay(sendInterval);
}

void sendData(String params) {
  HTTPClient http;
  String url = "https://script.google.com/macros/s/" + GOOGLE_SCRIPT_ID + "/exec?" + params;
  Serial.print(url);
  Serial.print("Making a request");
  http.begin(url, root_ca); //Specify the URL and certificate
  int httpCode = http.GET();
  http.end();
  Serial.println(": done " + httpCode);
}

I'm pretty sure the compiler gives more info

➜ post everything (copy & paste here using code tags the compilers output)

PS/ I just tried and it compiled correctly (with a few usual warnings)

Le croquis utilise 894197 octets (68%) de l'espace de stockage de programmes. Le maximum est de 1310720 octets.
Les variables globales utilisent 46104 octets (14%) de mémoire dynamique, ce qui laisse 281576 octets pour les variables locales. Le maximum est de 327680 octets.

you should not have to install the httpclient library. It comes with the ESP32 environment

Wow , i deleted it and it actually worked thank you :smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.