Copyright © https://mongoose-os.com

Mongoose OS Forum

frame

How does printf work?

I see printf function in example, such as https://github.com/cesanta/mongoose-os/blob/master/fw/examples/c_hello/src/main.c

When I write printf function in the c/c++ start-up example Starting with C/C++, that function doesn't work.

Here's my code.

#include "mgos.h"
#include "mgos_dht.h"

static void timer_cb(void *dht) {
     LOG(LL_INFO, ("Temperature: %lf", mgos_dht_get_temp(dht)));
 }

 enum mgos_app_init_result mgos_app_init(void) {
    struct mgos_dht *dht = mgos_dht_create(get_cfg()->app.pin, DHT22);
     mgos_set_timer(1000, true, timer_cb, dht);
     return MGOS_APP_INIT_SUCCESS;
 }

Comments

Sign In or Register to comment.