Send countdown messages from a port (paired with os/view_count.cpp example).
#include <cstdio>
constexpr double loop_delay = 1.0;
int main(
int argc,
char* argv[])
{
if (argc != 2) {
return 1;
}
BufferedPort<Bottle> out;
out.open(argv[1]);
for (int i = 10; i >= 0; i--) {
printf("at %d\n", i);
Bottle& msg = out.prepare();
msg.clear();
msg.addString("countdown");
msg.addInt32(i);
out.write();
}
return 0;
}