// Panik Web Form Demo
#define SERIAL_DEBUG
+#define ENABLE_UDP
// define network constants
#include <SPI.h>
#include <SD.h>
#include <Ethernet.h>
+#ifdef ENABLE_UDP
#include <EthernetUdp.h>
+#endif
// include third party libraries
#include "WebServer.h"
// instanciate web server
WebServer webserver(PREFIX, 80);
+#ifdef ENABLE_UDP
// and EthernetUDP instance to send notifications
EthernetUDP Udp;
IPAddress udp_remote_ip(192, 168, 17, 224);
+#endif
#define NAMELEN 4
#endif
while (1) ;
}
+ #ifdef ENABLE_UDP
if (! Udp.begin(1312)) {
#ifdef SERIAL_DEBUG
Serial.println(F("Failed to initiate UDP"));
#endif
}
+ #endif
// set mode for used pins
pinMode(RELAY_RED_LEDS, OUTPUT);
Serial.print(F("Active Selection: "));
Serial.println(activeSelection);
#endif
+ #ifdef ENABLE_UDP
// notify over UDP
snprintf(str_selection, 19, "{\"active\": %d}", activeSelection);
Udp.beginPacket(udp_remote_ip, 1312);
Udp.write(str_selection);
Udp.endPacket();
+ #endif
break;
}
}