This commit is contained in:
2024-07-03 10:31:03 +03:00
parent 4a216e773b
commit 618b4f4b4d
4 changed files with 31 additions and 19 deletions

View File

@ -60,6 +60,7 @@ void app_main(void)
i2c_new_master_bus(&i2c_bus_config, &i2c_bus_handle);
#endif
zh_bh1750_init_config_t bh1750_init_config = ZH_BH1750_INIT_CONFIG_DEFAULT();
bh1750_init_config.auto_adjust = true; // Just for an example of how to enable auto adjustment the sensor sensitivity.
#ifdef CONFIG_IDF_TARGET_ESP8266
bh1750_init_config.i2c_port = I2C_PORT;
#else
@ -72,7 +73,7 @@ void app_main(void)
{
zh_bh1750_read(&lux);
printf("Lux %0.2f\n", lux);
vTaskDelay(1000 / portTICK_PERIOD_MS);
vTaskDelay(5000 / portTICK_PERIOD_MS);
}
}
```