This commit is contained in:
Laura Hausmann 2019-08-16 14:03:05 +02:00
parent 09b05f3a65
commit f1f192932a
No known key found for this signature in database
GPG key ID: 1720DF2EC8974C2D
6 changed files with 25 additions and 18 deletions

View file

@ -1,7 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}

View file

@ -24,11 +24,12 @@ void setup(void) {
u8g2.setFont(u8g2_font_6x10_mf);
u8g2.setFontMode(0);
WiFi.mode(WIFI_STA);
WiFiMulti.addAP("Darknet-IOT", "kekseFTW");
WiFiMulti.addAP("MSTN-WS-N", "DEADC0FFEE1234567890DEC0DE");
}
uint16_t adcval = 300;
unsigned char contrast = 0;
String state = "Off";
void loop(void) {
u8g2.firstPage();
WiFiClient client;
@ -45,8 +46,8 @@ void loop(void) {
u8g2.drawStr(0, 17, ipbuf);
u8g2.drawStr(0, 27, "api rq...");
String url = String("http://ctrans.local:5000/api") + "?mac=" + WiFi.macAddress() + "&datatype=int"
+ "&actortype=ESP8266_simple_actor" + "&state=Waiting";
String url = String("http://kaby.fritz.box:5000/api") + "?mac=" + WiFi.macAddress() + "&datatype=int"
+ "&actortype=ESP8266_simple_actor" + "&state=" + state;
if(http.begin(client, url)) {
int httpCode = http.GET();
@ -55,10 +56,12 @@ void loop(void) {
Serial.printf("HTTP Response Code: %d\n", httpCode);
if (payload == "1"){
Serial.println("HIGH:" + payload);
state = "On";
digitalWrite(D3, HIGH);
}
else{
Serial.println("LOW:" + payload);
state = "Off";
digitalWrite(D3, LOW);
}
if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {

View file

@ -12,6 +12,10 @@
"terminal.integrated.env.linux": {
"PATH": "/home/laura/.platformio/penv/bin:/home/laura/.platformio/penv:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl",
"PLATFORMIO_CALLER": "vscode"
},
"terminal.integrated.env.osx": {
"PATH": "/Users/laura/.platformio/penv/bin:/Users/laura/.platformio/penv:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/TeX/texbin:/usr/local/MacGPG2/bin:/usr/local/share/dotnet:~/.dotnet/tools",
"PLATFORMIO_CALLER": "vscode"
}
}
}

View file

@ -1,7 +1,7 @@
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
{
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"platformio.platformio-ide"
]
}

View file

@ -11,4 +11,4 @@
[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
framework = arduino

View file

@ -22,7 +22,7 @@ void setup(void) {
u8g2.setFont(u8g2_font_6x10_mf);
u8g2.setFontMode(0);
WiFi.mode(WIFI_STA);
WiFiMulti.addAP("Darknet-IOT", "kekseFTW");
WiFiMulti.addAP("MSTN-WS-N", "DEADC0FFEE1234567890DEC0DE");
pinMode(D3, INPUT_PULLUP);
pinMode(D6, INPUT_PULLUP);
pinMode(D7, INPUT_PULLUP);
@ -59,7 +59,7 @@ void loop(void) {
if (!tmp){
tmp = true;
state = !state;
String url = String("http://ctrans.local:5000/api") + "?mac=" + WiFi.macAddress() + "&datatype=bool"
String url = String("http://kaby.fritz.box:5000/api") + "?mac=" + WiFi.macAddress() + "&datatype=bool"
+ "&sensortype=ESP8266_simple_sensor" + "&value=" + state + "&displayunit=nA";
if(http.begin(client, url)) {
int httpCode = http.GET();