Skip to content

Instantly share code, notes, and snippets.

@PharkMillups
Last active November 7, 2017 18:42
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 PharkMillups/9ce8b9c5b0d84c9ad6cba5ced84f803a to your computer and use it in GitHub Desktop.
Save PharkMillups/9ce8b9c5b0d84c9ad6cba5ced84f803a to your computer and use it in GitHub Desktop.
config-examples.ino
void
loop()
{
//Create Json object with buffer to match data size
StaticJsonBuffer<JSON_OBJECT_SIZE(2) + 35> jsonBuffer;
JsonObject & root = jsonBuffer.createObject();
root[F("interval")] = send_interval; //JSON MESSAGE
char buffer[HELIUM_MAX_DATA_SIZE];
size_t used = root.printTo(buffer, HELIUM_MAX_DATA_SIZE);
// Send data to channel
channel_send(&channel, CHANNEL_NAME, buffer, used);
// Check if Config is updated with server
update_config(config.is_stale());
// Wait a while till the next time
dexlay(send_interval);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment