Skip to content

Si7005 Temperature and Humidity Sensor Driver for Mongoose OS

License

Notifications You must be signed in to change notification settings

mongoose-os-libs/si7005

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Si7005 Sensor Driver for Mongoose OS

Overview

Si7005 is a temperature and relative humidity sensor by Silicon Labs.

This library provides a driver for this device.

API documentation

See include/si7005.h.

Example

#include "mgos.h"

#include "si7005.h"

static void temp_timer_cb(void *arg) {
  float temp = si7005_read_temp();
  float rh = si7005_read_rh();
  LOG(LL_INFO, ("T %.2f RH %.2f", temp, rh));
  (void) arg;
}

enum mgos_app_init_result mgos_app_init(void) {
  if (si7005_probe()) {
    LOG(LL_INFO, ("Si7005 sensor found"));
    mgos_set_timer(1000, MGOS_TIMER_REPEAT, temp_timer_cb, NULL);
  } else {
    LOG(LL_WARN, ("Failed to init temp sensor"));
  }
  return MGOS_APP_INIT_SUCCESS;
}

Note: You need to make sure that I2C is enabled. This can be achieved by adding

config_schema:
  - ["i2c.enable", true]

to mos.yml. You may need to adjust SDA and SCL pins as well. See I2C library for details.

About

Si7005 Temperature and Humidity Sensor Driver for Mongoose OS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages