Skip to content

Commit

Permalink
Merge pull request #3 from nikwest/master
Browse files Browse the repository at this point in the history
Update mgos_sht31.c
  • Loading branch information
pimvanpelt authored Oct 23, 2021
2 parents 882bd14 + e0c8ebd commit b1e3632
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/mgos_sht31.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,14 @@ struct mgos_sht31 *mgos_sht31_create(struct mgos_i2c *i2c, uint8_t i2caddr) {
sensor->i2c = i2c;

mgos_sht31_cmd(sensor, MGOS_SHT31_SOFTRESET);

mgos_usleep(2000);
// Toggle heater on and off, which shows up in status register bit 13 (0=Off, 1=On)
status0 = mgos_sht31_status(sensor); // heater is off, bit13 is 0
mgos_usleep(2000);
mgos_sht31_cmd(sensor, MGOS_SHT31_HEATEREN);
mgos_usleep(2000);
status1 = mgos_sht31_status(sensor); // heater is on, bit13 is 1
mgos_usleep(2000);
mgos_sht31_cmd(sensor, MGOS_SHT31_HEATERDIS);
status2 = mgos_sht31_status(sensor); // heater is off, bit13 is 0

Expand Down

0 comments on commit b1e3632

Please # to comment.