// multi gas sensor
#include <Wire.h>
#include "MutichannelGasSensor.h"
// Initialize multi-channel gas sensor
gas.begin(0x04);//the default I2C address of the slave is 0x04
gas.powerOn();
// **************** multi channel gas measurements
float c, gas_nh3, gas_co, gas_no2, gas_c3h8;
c = gas.measure_NH3();
Serial.print("The concentration of NH3 is ");
if(c>=0) Serial.print(c);
else Serial.print("invalid");
Serial.println(" ppm");
gas_nh3 = c;
c = gas.measure_CO();
Serial.print("The concentration of CO is ");
if(c>=0) Serial.print(c);
else Serial.print("invalid");
Serial.println(" ppm");
gas_co = c;
c = gas.measure_NO2();
Serial.print("The concentration of NO2 is ");
if(c>=0) Serial.print(c);
else Serial.print("invalid");
Serial.println(" ppm");
gas_no2 = c;
c = gas.measure_C3H8();
Serial.print("The concentration of C3H8 is ");
if(c>=0) Serial.print(c);
else Serial.print("invalid");
Serial.println(" ppm");
gas_c3h8 = c;
c = gas.measure_C4H10();
Serial.print("The concentration of C4H10 is ");
if(c>=0) Serial.print(c);
else Serial.print("invalid");
Serial.println(" ppm");
c = gas.measure_CH4();
Serial.print("The concentration of CH4 is ");
if(c>=0) Serial.print(c);
else Serial.print("invalid");
Serial.println(" ppm");
c = gas.measure_H2();
Serial.print("The concentration of H2 is ");
if(c>=0) Serial.print(c);
else Serial.print("invalid");
Serial.println(" ppm");
c = gas.measure_C2H5OH();
Serial.print("The concentration of C2H5OH is ");
if(c>=0) Serial.print(c);
else Serial.print("invalid");
Serial.println(" ppm");
![Screenshot 2022-05-31 101254|690x177](upload://4oN2ChdTtdSxEP27PeilanwAj4F.png)
It would help if you posted the complete output with the error message in it.
Perhaps this library is not implemented for your board. Read the documentation, try a library example and check without this library.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.