Browse Source

Latest changes

master
Maximilian Stiefel 3 years ago
parent
commit
01ec726912
  1. 18
      app/application.cpp

18
app/application.cpp

@ -18,10 +18,6 @@ std::vector<uint8_t> colorVec{LED_R, LED_G, LED_B};
HttpServer server;
FtpServer ftp;
int inputs[] = {0, 2}; // Set input GPIO pins here
Vector<String> namesInput;
const int countInputs = sizeof(inputs) / sizeof(inputs[0]);
uint8_t pins[3] = {LED_R, LED_G, LED_B}; // List of pins that you want to connect to pwm
HardwarePWM HW_pwm(pins, 3);
@ -65,9 +61,9 @@ void onAjaxInput(HttpRequest& request, HttpResponse& response)
}
JsonObject gpio = json.createNestedObject("gpio");
for(int i = 0; i < countInputs; i++)
gpio[namesInput[i].c_str()] = digitalRead(inputs[i]);
/*for(int i = 0; i < countInputs; i++)
gpio[namesInput[i].c_str()] = digitalRead(inputs[i]);
*/
response.sendDataStream(stream, MIME_JSON);
}
@ -121,9 +117,9 @@ void gotIP(IpAddress ip, IpAddress netmask, IpAddress gateway)
startWebServer();
Serial.println("Grueziii <<<<<<<<<<<<<<<<<<<<<");
for (const uint8_t& c : colorVec) {
setColor(c, 100);
setColor(c, 0);
}
//setColor(LED_G, 50);
setColor(LED_G, 0);
}
void init()
@ -137,10 +133,10 @@ void init()
WifiStation.config(WIFI_SSID, WIFI_PWD);
WifiAccessPoint.enable(false);
for(int i = 0; i < countInputs; i++) {
/*for(int i = 0; i < countInputs; i++) {
namesInput.add(String(inputs[i]));
pinMode(inputs[i], INPUT);
}
}*/
// Run our method when station was connected to AP
WifiEvents.onStationGotIP(gotIP);

Loading…
Cancel
Save