added home network to script
This commit is contained in:
@@ -1,26 +1,41 @@
|
|||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
#include <WiFiClient.h>
|
#include <WiFiClient.h>
|
||||||
#include <WiFiAP.h>
|
#include <WiFiAP.h>
|
||||||
|
#include <WiFiMulti.h>
|
||||||
|
#include <HTTPClient.h>
|
||||||
|
|
||||||
|
WiFiMulti wifiMulti;
|
||||||
|
HTTPClient http;
|
||||||
|
|
||||||
|
char temperature = 20;
|
||||||
|
char light = 3500;
|
||||||
|
char humidity = 54;
|
||||||
const char* ssid = "iotroam";
|
const char* ssid = "iotroam";
|
||||||
const char* password = "BcgrFpX3kl";
|
const char* password = "BcgrFpX3kl";
|
||||||
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
Serial.print("mac adress:");
|
Serial.print("mac adress:");
|
||||||
Serial.println(WiFi.macAddress());
|
Serial.println(WiFi.macAddress());
|
||||||
WiFi.mode(WIFI_AP);
|
WiFi.mode(WIFI_STA);
|
||||||
WiFi.begin(ssid, password);
|
wifiMulti.addAP("ObsidianAmstelveen", "drijversstraatmaastricht");
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
wifiMulti.addAP("iotroam", "BcgrFpX3kl");
|
||||||
Serial.print('.');
|
while (wifiMulti.run() != WL_CONNECTED) {
|
||||||
delay(1000);
|
|
||||||
}
|
}
|
||||||
Serial.println(WiFi.localIP());
|
Serial.println(WiFi.localIP());
|
||||||
|
|
||||||
|
|
||||||
|
http.begin("http://hva-onto.nl/api/ti/map/measurements/add");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|
||||||
|
String httpRequestData = "api_key=efffc47610ea6282a3416f71b51b3a&temperature=temperature&light=light&humidity=humidity";
|
||||||
|
|
||||||
|
int httpResponseCode = http.POST(httpRequestData);
|
||||||
|
|
||||||
|
Serial.print("HTTP Response code: ");
|
||||||
|
Serial.println(httpResponseCode);
|
||||||
|
break(10000)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user