This commit is contained in:
2026-02-09 16:36:29 +01:00
parent af9e0c11e0
commit 0f50ddbae3
18 changed files with 610 additions and 293 deletions

View File

@@ -5,21 +5,16 @@
void app_main(void) {
scd30_data_t sensor_data;
// Initialize the SCD30 sensor
scd30_init();
scd30_start_measurement();
// Example: SDA = 21, SCL = 22 (change as needed)
scd30_handle_t *scd30 = scd30_init(21, 22);
scd30_start_measurement(scd30);
while (1) {
// Read data from the sensor
if (scd30_read_data(&sensor_data) == 0) {
if (scd30_read_data(scd30, &sensor_data) == 0) {
printf("CO2: %.2f ppm, Temp: %.2f °C, Humidity: %.2f %%\n",
sensor_data.co2, sensor_data.temp, sensor_data.humidity);
} else {
printf("Failed to read data from SCD30 sensor\n");
}
// Wait for 2 seconds
vTaskDelay(pdMS_TO_TICKS(2000));
}
}
}