GP output function added
This commit is contained in:
parent
02443ed697
commit
b09f450171
@ -37,6 +37,9 @@
|
||||
//Hardware-settings (only changeble via code)
|
||||
#define LEDCOUNT 84
|
||||
uint8_t buttonPin = 0; //needs pull-up
|
||||
uint8_t auxPin = 16; //use e.g. for external relay
|
||||
uint8_t auxDefaultState = 0; //0: input 1: high 2: low
|
||||
uint8_t auxTriggeredState = 0; //0: input 1: high 2: low
|
||||
|
||||
//AP and OTA default passwords (change them!)
|
||||
String appass = "wled1234";
|
||||
@ -133,6 +136,9 @@ boolean nixiePause;
|
||||
long countdownTime = 1483225200L;
|
||||
boolean arlsTimeout = false;
|
||||
long arlsTimeoutTime;
|
||||
uint8_t auxTime = 0;
|
||||
long auxStartTime;
|
||||
boolean auxActive, auxActiveBefore;
|
||||
|
||||
ESP8266WebServer server(80);
|
||||
ESP8266HTTPUpdateServer httpUpdater;
|
||||
|
@ -281,6 +281,12 @@ boolean handleSet(String req)
|
||||
nightlightStartTime = millis();
|
||||
}
|
||||
}
|
||||
pos = req.indexOf("AX=");
|
||||
if (pos > 0) {
|
||||
auxTime = req.substring(pos + 3).toInt();
|
||||
auxActive = true;
|
||||
if (auxTime == 0) auxActive = false;
|
||||
}
|
||||
XML_response();
|
||||
if (effectUpdated)
|
||||
{
|
||||
|
@ -28,4 +28,31 @@ void handleButton()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//output
|
||||
if (auxActive || auxActiveBefore)
|
||||
{
|
||||
if (!auxActiveBefore)
|
||||
{
|
||||
auxActiveBefore = true;
|
||||
switch (auxTriggeredState)
|
||||
{
|
||||
case 0: pinMode(auxPin, INPUT); break;
|
||||
case 1: pinMode(auxPin, OUTPUT); digitalWrite(auxPin, HIGH); break;
|
||||
case 2: pinMode(auxPin, OUTPUT); digitalWrite(auxPin, LOW); break;
|
||||
}
|
||||
auxStartTime = millis();
|
||||
}
|
||||
if ((millis() - auxStartTime > auxTime*1000 && auxTime != 255) || !auxActive)
|
||||
{
|
||||
auxActive = false;
|
||||
auxActiveBefore = false;
|
||||
switch (auxDefaultState)
|
||||
{
|
||||
case 0: pinMode(auxPin, INPUT); break;
|
||||
case 1: pinMode(auxPin, OUTPUT); digitalWrite(auxPin, HIGH); break;
|
||||
case 2: pinMode(auxPin, OUTPUT); digitalWrite(auxPin, LOW); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user