Help on the second code

What is the code and library for this instead

Hi, would you please elaborate a little bit more? What are you trying to do?

1 Like

all the hookup information is on Introduction - SparkFun Indoor Air Sensor SCD41, SEN55 (Qwiic) Hookup Guide

1 Like

#include <Wire.h>
#include <SparkFun_SCD30_Arduino_Library.h>

SCD30 airSensor;

void setup() {
Serial.begin(9600);
Serial.println(“SCD30 Example”);

Wire.begin();

if (airSensor.begin() == false) {
Serial.println(“Air sensor not detected. Please check wiring.”);
while (1); // Halt if sensor not found
}

// Optional settings (adjust as needed)
airSensor.setMeasurementInterval(2); // Set measurement interval in seconds (2-1800)
airSensor.setAltitudeCompensation(0); // Set altitude compensation in meters
airSensor.setAutoSelfCalibration(true); // Enable auto-self-calibration
}

void loop() {
if (airSensor.dataAvailable()) {
Serial.print("CO2(ppm): ");
Serial.print(airSensor.getCO2());

Serial.print(" Temperature(C): ");
Serial.print(airSensor.getTemperature(), 1);

Serial.print(" Humidity(%): ");
Serial.print(airSensor.getHumidity(), 1);

Serial.println();

}
delay(1000); // Wait 1 second between readings
}
Is this code correct based on the sensor reading ? Help me rectify it and what is the library needed as when i tried it , no results shown .

What kind of air does this code measure

air quality for CO2


Why my code still show errors when i want to show results for Co2

same thing happened to me even after downloading the 3 libraries and using the examples from hookup guide


Why is there no numbers for measurement?

Check your serial baud rate in arduino, it must match the baud rate in the code.

Like Yellowdog said, try 115200 baud

Hi thanks for all your help i just had to changed the seriel.begin(9600); and it got readings