Reed-input working
This commit is contained in:
parent
2c6bf4ee6c
commit
ce7f4ce364
@ -12,7 +12,8 @@
|
||||
platform = espressif8266
|
||||
board = d1_mini
|
||||
board_build.filesystem = littlefs
|
||||
board_build.ldscript = eagle.flash.4m2m.ld
|
||||
board_build.f_flash = 80000000L
|
||||
board_build.ldscript = eagle.flash.4m1m.ld
|
||||
|
||||
framework = arduino
|
||||
lib_deps =
|
||||
|
27
src/main.cpp
27
src/main.cpp
@ -33,14 +33,18 @@ enum Parties
|
||||
void SevenSeg_Output();
|
||||
void ticker_callback();
|
||||
void serialOut_callback();
|
||||
void inputGetter_callback();
|
||||
|
||||
TM1637Display disp_GOF(CLK, DIO_GOF_7SEG);
|
||||
TM1637Display disp_MIL(CLK, DIO_MIL_7SEG);
|
||||
TM1637Display disp_KGG(CLK, DIO_KGG_7SEG);
|
||||
|
||||
DNSServer dnsServer;
|
||||
AsyncWebServer server(80);
|
||||
|
||||
Ticker PartyTicker(ticker_callback, 500, 0, MILLIS);
|
||||
Ticker SerialOutputTicker(serialOut_callback, 5000, 0, MILLIS);
|
||||
Ticker InputGetterTicker(inputGetter_callback, 500, 0, MILLIS);
|
||||
|
||||
Parties activeParty = NONE;
|
||||
|
||||
@ -205,6 +209,26 @@ void serialOut_callback()
|
||||
SerialPrintCount++;
|
||||
}
|
||||
|
||||
void inputGetter_callback()
|
||||
{
|
||||
activeParty = NONE;
|
||||
|
||||
if (digitalRead(DIO_GOF_TRG) + digitalRead(DIO_MIL_TRG) + digitalRead(DIO_KGG_TRG) < 2)
|
||||
{
|
||||
Serial.println("ERROR: More than one Flag active");
|
||||
return;
|
||||
}
|
||||
|
||||
if (digitalRead(DIO_GOF_TRG) == LOW)
|
||||
activeParty = GOF;
|
||||
|
||||
if (digitalRead(DIO_KGG_TRG) == LOW)
|
||||
activeParty = KGG;
|
||||
|
||||
if (digitalRead(DIO_MIL_TRG) == LOW)
|
||||
activeParty = MILIZ;
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
pinMode(DIO_GOF_TRG, INPUT_PULLUP);
|
||||
@ -223,12 +247,15 @@ void setup()
|
||||
|
||||
PartyTicker.start();
|
||||
SerialOutputTicker.start();
|
||||
InputGetterTicker.start();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
PartyTicker.update();
|
||||
SerialOutputTicker.update();
|
||||
InputGetterTicker.update();
|
||||
|
||||
dnsServer.processNextRequest();
|
||||
SevenSeg_Output();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user