← Back to the chapter · Previous detail

Technical detail · Capstone Projects: Agriculture and Environment

Read and display the first sensor sample

// Milestone 1: Basic sensor reading
void loop() {
    float temp = readTemperature();
    float humidity = readHumidity();
    int co2 = readCO2();
    float pm25 = readPM25();

    Serial.printf("T:%.1f H:%.1f CO2:%d PM2.5:%.1f\n",
                  temp, humidity, co2, pm25);
    displayOnOLED(temp, humidity, co2, pm25);
    delay(5000);
}

← Back to the chapter · Previous detail