bh1750 I2C

Github Repo C Header C source JS source
mongoose-os-libs/bh1750 bh1750.h    

Overview

BH1750 ambient light sensor native C driver for Mongoose OS

Sensor wiring

Todo

  • implement sensor sensitivity adjusting
  • use timer instead of mgos_msleep?

Usage

struct sensor_bh1750* bh = sensor_bh1750_create(0x23);

float lux = sensor_bh1750_get_lux(bh, ONE_TIME_HIGH_RES_MODE_2);
printf("Light: %f lux\n", lux);

sensor_bh1750_free(bh, false);

edit this doc