formatting
This commit is contained in:
@@ -24,27 +24,25 @@ void setup() {
|
|||||||
pinMode(4, OUTPUT);
|
pinMode(4, OUTPUT);
|
||||||
pinMode(5, OUTPUT);
|
pinMode(5, OUTPUT);
|
||||||
pinMode(6, OUTPUT);
|
pinMode(6, OUTPUT);
|
||||||
digitalWrite(6, HIGH);
|
digitalWrite(6, HIGH);
|
||||||
|
|
||||||
//print het hardware ID van de esp32S3
|
//print het hardware ID van de esp32S3
|
||||||
Serial.print("mac adress:");
|
Serial.print("mac adress:");
|
||||||
Serial.println(WiFi.macAddress());
|
Serial.println(WiFi.macAddress());
|
||||||
//verbinden met wifi
|
//verbinden met wifi
|
||||||
WiFi.mode(WIFI_STA);
|
WiFi.mode(WIFI_STA);
|
||||||
wifiMulti.addAP("ObsidianAmstelveen", "drijversstraatmaastricht");
|
wifiMulti.addAP("ObsidianAmstelveen", "drijversstraatmaastricht");
|
||||||
wifiMulti.addAP("iotroam", "BcgrFpX3kl");
|
wifiMulti.addAP("iotroam", "BcgrFpX3kl");
|
||||||
//een loop zodat het script wacht tot de esp32s3 verbind met het internet
|
//een loop zodat het script wacht tot de esp32s3 verbind met het internet
|
||||||
while (wifiMulti.run() != WL_CONNECTED) {
|
while (wifiMulti.run() != WL_CONNECTED) {
|
||||||
}
|
}
|
||||||
//print het ip adress van de esp32s3 naar de console
|
//print het ip adress van de esp32s3 naar de console
|
||||||
Serial.println(WiFi.localIP());
|
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);
|
|
||||||
|
|
||||||
|
|
||||||
|
//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() {
|
void loop() {
|
||||||
@@ -67,7 +65,7 @@ void loop() {
|
|||||||
Serial.println(Luchtvochtigheid);
|
Serial.println(Luchtvochtigheid);
|
||||||
|
|
||||||
Serial.print("LDR reading: ");
|
Serial.print("LDR reading: ");
|
||||||
Serial.println(Lichtsterkte);
|
Serial.println(Lichtsterkte);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -76,17 +74,13 @@ void loop() {
|
|||||||
//voeg een header toe aan de post request
|
//voeg een header toe aan de post request
|
||||||
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
|
http.addHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
//de data stoppen in een variabel voor de post request
|
//de data stoppen in een variabel voor de post request
|
||||||
String httpRequestData = "type=temperature&value=" + String(Temparatuur);
|
String httpRequestData = "type=temperature&value=" + String(Temparatuur);
|
||||||
//stuur de post request naar de server toe
|
//stuur de post request naar de server toe
|
||||||
int httpResponseCode = http.POST(httpRequestData);
|
int httpResponseCode = http.POST(httpRequestData);
|
||||||
//print de response code naar
|
//print de response code naar
|
||||||
Serial.print("HTTP Response code:");
|
Serial.print("HTTP Response code:");
|
||||||
Serial.println(httpResponseCode);
|
Serial.println(httpResponseCode);
|
||||||
//wacht x aanal miliseconden
|
//wacht x aanal miliseconden
|
||||||
digitalWrite(5, HIGH);
|
digitalWrite(5, HIGH);
|
||||||
delay(400);
|
delay(400);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user