Created
March 22, 2017 20:45
-
-
Save hgoldwire/a2ad4a665858a0e323103f8dfd211bd8 to your computer and use it in GitHub Desktop.
This hangs after 10 seconds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Particle.h" | |
class UdpThing : LogHandler | |
{ | |
UDP Udp; | |
public: | |
UdpThing() { | |
LogManager::instance()->addHandler(this); | |
}; | |
void ready() | |
{ | |
Udp.begin(9999); | |
} | |
void logMessage(const char *msg, LogLevel level, const char *category, const LogAttributes &attr) | |
{ | |
Serial.printlnf("logger: %s", msg); | |
if (millis() > 10000) { | |
Udp.beginPacket({54, 173, 129, 125}, 4567); | |
Udp.write("hey "); | |
Udp.endPacket(); | |
} | |
} | |
}; | |
SerialLogHandler serialLogHandler; | |
UdpThing udpThing; | |
void setup() | |
{ | |
udpThing.ready(); | |
} | |
void loop() | |
{ | |
Log.info("%d ping", millis()); | |
delay(500); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment