Created
February 5, 2016 14:12
-
-
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)
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 "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