diff --git a/arduino/sensor combo/combi/combi.ino b/arduino/sensor combo/combi/combi.ino index 538283a..4d7f379 100644 --- a/arduino/sensor combo/combi/combi.ino +++ b/arduino/sensor combo/combi/combi.ino @@ -24,27 +24,25 @@ void setup() { pinMode(4, OUTPUT); pinMode(5, OUTPUT); pinMode(6, OUTPUT); - digitalWrite(6, HIGH); + digitalWrite(6, HIGH); - //print het hardware ID van de esp32S3 - Serial.print("mac adress:"); - Serial.println(WiFi.macAddress()); - //verbinden met wifi - WiFi.mode(WIFI_STA); - wifiMulti.addAP("ObsidianAmstelveen", "drijversstraatmaastricht"); - wifiMulti.addAP("iotroam", "BcgrFpX3kl"); - //een loop zodat het script wacht tot de esp32s3 verbind met het internet - while (wifiMulti.run() != WL_CONNECTED) { - } + //print het hardware ID van de esp32S3 + Serial.print("mac adress:"); + Serial.println(WiFi.macAddress()); + //verbinden met wifi + WiFi.mode(WIFI_STA); + wifiMulti.addAP("ObsidianAmstelveen", "drijversstraatmaastricht"); + wifiMulti.addAP("iotroam", "BcgrFpX3kl"); + //een loop zodat het script wacht tot de esp32s3 verbind met het internet + while (wifiMulti.run() != WL_CONNECTED) { + } //print het ip adress van de esp32s3 naar de console - Serial.println(WiFi.localIP()); - - //gebruikt deze website om posts requests naar toe te sturen - http.begin("http://hva-onto.nl/api/ti/map/measurements/add?api-key=efffc47610ea6282a3416f71b51b3a"); - //lampje aan om aan te geven dat esp32S3 is verbonden met internet - digitalWrite(4, HIGH); - + Serial.println(WiFi.localIP()); + //gebruikt deze website om posts requests naar toe te sturen + http.begin("http://hva-onto.nl/api/ti/map/measurements/add?api-key=efffc47610ea6282a3416f71b51b3a"); + //lampje aan om aan te geven dat esp32S3 is verbonden met internet + digitalWrite(4, HIGH); } void loop() { @@ -67,7 +65,7 @@ void loop() { Serial.println(Luchtvochtigheid); Serial.print("LDR reading: "); - Serial.println(Lichtsterkte); + Serial.println(Lichtsterkte); @@ -76,17 +74,13 @@ void loop() { //voeg een header toe aan de post request http.addHeader("Content-Type", "application/x-www-form-urlencoded"); //de data stoppen in een variabel voor de post request - String httpRequestData = "type=temperature&value=" + String(Temparatuur); - //stuur de post request naar de server toe + String httpRequestData = "type=temperature&value=" + String(Temparatuur); + //stuur de post request naar de server toe int httpResponseCode = http.POST(httpRequestData); - //print de response code naar - Serial.print("HTTP Response code:"); - Serial.println(httpResponseCode); - //wacht x aanal miliseconden + //print de response code naar + Serial.print("HTTP Response code:"); + Serial.println(httpResponseCode); + //wacht x aanal miliseconden digitalWrite(5, HIGH); delay(400); - - - - } \ No newline at end of file