added home network to script
This commit is contained in:
@@ -1,26 +1,41 @@
|
||||
#include <WiFi.h>
|
||||
#include <WiFiClient.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* password = "BcgrFpX3kl";
|
||||
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
Serial.print("mac adress:");
|
||||
Serial.println(WiFi.macAddress());
|
||||
WiFi.mode(WIFI_AP);
|
||||
WiFi.begin(ssid, password);
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
Serial.print('.');
|
||||
delay(1000);
|
||||
WiFi.mode(WIFI_STA);
|
||||
wifiMulti.addAP("ObsidianAmstelveen", "drijversstraatmaastricht");
|
||||
wifiMulti.addAP("iotroam", "BcgrFpX3kl");
|
||||
while (wifiMulti.run() != WL_CONNECTED) {
|
||||
}
|
||||
Serial.println(WiFi.localIP());
|
||||
|
||||
|
||||
http.begin("http://hva-onto.nl/api/ti/map/measurements/add");
|
||||
|
||||
}
|
||||
|
||||
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