Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ESP8266WiFi.h>
- #include <WiFiUdp.h>
- WiFiUDP graphitesock;
- #define CARBON_HOST "carbon.hostedgraphite.com"
- #define CARBON_PORT 2003
- #define PREFIX "your-hosted-graphite-api-key-here"
- // Place this inside 'main'
- // graphitesock.begin(random(40000, 60000));
- bool graphiteudp(char *host, int port, char *format, ...)
- {
- char *buf = (char *) malloc(MAX_PACKET_SIZE);
- va_list args;
- va_start(args, format);
- vsnprintf(buf, MAX_PACKET_SIZE, format, args);
- va_end(args);
- graphitesock.beginPacket(host, port);
- graphitesock.write(buf);
- int retval = graphitesock.endPacket();
- free(buf);
- return retval == 1;
- }
Add Comment
Please, Sign In to add comment