Hello
I wanted to use the MQTT simple example (which works great) and add timer, so that MQTT will be send every 20 seconds:
on main I added:
struct k_timer my_timer;
k_timer_init(&bz_timer, bz_func, NULL);
k_timer_start(&bz_timer, K_SECONDS(20), K_SECONDS(20));
then on bz_func :
void bz_func ()
{
int ret;
for (int i = 0; i < 100; i++)
{
ret = data_publish(&client,
MQTT_QOS_1_AT_LEAST_ONCE,
"CONFIG_BUTTON_EVENT_PUBLISH_MSG",
sizeof("CONFIG_BUTTON_EVENT_PUBLISH_MSG")-1);
if (ret) {
LOG_ERR("Publish failed: %d", ret);
}
}
}
this fails to send, even more, once timer is first activated, I can not send via the EVB button
please advice how it' s best to accomplish what I need (send MQTT automatically every 20 seconds )