Skip to content

Instantly share code, notes, and snippets.

@Overdrivr
Created February 5, 2016 14:12
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 Overdrivr/6ae85079a586c0f8dfc3 to your computer and use it in GitHub Desktop.
Save Overdrivr/6ae85079a586c0f8dfc3 to your computer and use it in GitHub Desktop.
Example to use telemetry to publish regularly a value on a topic (MBED)
#include "telemetry/driver.hpp"
int main()
{
// User state - not used for now
TM_state state;
// Create a telemetry instance
Telemetry TM(&state);
Timer t;
t.start();
int8_t d = 0;
for( ; ; )
{
if(t.read() > 0.5f) // publish every 500 ms
{
d++;
TM.pub_i8("somevar", d);
t.reset();
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment