mirror of
https://github.com/alexandrebobkov/ESP-Nodes.git
synced 2025-11-02 08:06:22 +00:00
esp32 temperature node
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
#define MPU9250_SENSOR_ADDR 0x76 /*!< Slave address of the MPU9250 sensor */
|
||||
|
||||
static bme280_handle_t sensor = NULL;
|
||||
float *temperature;
|
||||
float temperature = 0.0f;
|
||||
|
||||
void app_main(void)
|
||||
{
|
||||
@@ -61,8 +61,10 @@ void app_main(void)
|
||||
|
||||
printf("Minimum free heap size: %" PRIu32 " bytes\n", esp_get_minimum_free_heap_size());
|
||||
|
||||
i2c_master_init();
|
||||
sensor = bme280_create(I2C_MASTER_NUM, MPU9250_SENSOR_ADDR);
|
||||
ESP_ERROR_CHECK(bme280_default_init(sensor));
|
||||
ESP_ERROR_CHECK(bme280_read_temperature(sensor, temperature));
|
||||
ESP_ERROR_CHECK(bme280_read_temperature(sensor, &temperature));
|
||||
|
||||
for (int i = 10; i >= 0; i--) {
|
||||
printf("Restarting in %d seconds...\n", i);
|
||||
|
||||
Reference in New Issue
Block a user