Skip to content

Instantly share code, notes, and snippets.

@hgoldwire
Created March 22, 2017 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hgoldwire/a2ad4a665858a0e323103f8dfd211bd8 to your computer and use it in GitHub Desktop.
Save hgoldwire/a2ad4a665858a0e323103f8dfd211bd8 to your computer and use it in GitHub Desktop.
This hangs after 10 seconds
#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