Skip to content
/ ezo-i2c Public

Porting Atlas Scientific's official EZO I2C library for the Mongoose OS platform

License

Notifications You must be signed in to change notification settings

Enophi/ezo-i2c

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EZO I2C C Library for Mongoose OS

Overview

This is a port of Atlas Scientific's EZO I2C library for Mongoose OS. See the official library.

Palteform support

Currently only build on ESP8266/ESP32 plateforms.

Example

The i2c configuration must be enabled : i2c.enable=true

#include "mgos.h"
#include "mgos_ezo_i2c.h"
#include "mgos_gpio.h"
#include "mgos_timers.h"

#define DEFAULT_TEMPERATURE 25.0f

static void loop_cb(void *args) {
    Ezo_Board *board = (Ezo_Board *)args;

    mgos_ezo_send_read_cmd(board);

    mgos_usleep(600000); // 600 ms processing delay

    Ezo_Errors status = mgos_ezo_receive_read_cmd(board);
    float temp_reading = mgos_ezo_get_last_received_reading(board);
    LOG(LL_INFO, (">>> %f", temp_reading));
    (void) status;
}

enum mgos_app_init_result mgos_app_init(void) {
    mgos_gpio_set_mode(15, MGOS_GPIO_MODE_OUTPUT);
    mgos_gpio_write(15, true);

    Ezo_Board *RTD = mgos_ezo_board_init_with_name(102, "RTD");

    mgos_set_timer(5000, true, loop_cb, RTD);

    return MGOS_APP_INIT_SUCCESS;
}

Author

  • David Cruchon

About

Porting Atlas Scientific's official EZO I2C library for the Mongoose OS platform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages