#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <RTClib.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <WiFi.h>
#include <HTTPClient.h>
const char ssid[2][] = {"TP-Link_DD7F","EVEIL_WIFI"};
const char password[2][] = {"53562244","maison de jeunes cool"};
const int oneWireBus = 2;
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(oneWireBus);
// Pass our oneWire reference to Dallas Temperature sensor
DallasTemperature sensors(&oneWire);
RTC_DS3231 rtc;
HTTPClient http;
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 64, &Wire, -1);
String HOST_NAME = "http://eveilsecure.myds.me/eveilcomestilab/php";
String PHP_FILE_NAME = "/addDatas.php";
String sonde = "s="; //identifiant de la sonde dans la base de données
String valeur = "&v="; //contiendra la valeur renvoyée par la sonde
String type = "&t=4"; //type de données ( 4. température 5. humidité )
String sondeID = "19";
String tempQuery = "?" + sonde + sondeInt + type + valeur ;
void sendData(String server){
http.begin(server);
int httpCode = http.GET();
if(httpCode > 0) {
if(httpCode == HTTP_CODE_OK) {
String payload = http.getString();
Serial.println(payload);
} else {
Serial.printf("HTTP GET... code: %d\n", httpCode);
Serial.print(server);
}
} else {
Serial.printf("HTTP GET... failed, error: %s\n", http.errorToString(httpCode).c_str());
}
http.end();
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}