SEN0159 Co2 Sensor, Adding tabs

I have an Arduino Uno with DHT22 and a DS18B20 connected, displaying reading on and LCD. Connected it all with the help of circuito.io . I’m wanting to add a SEN0159 Co2 sensor now. I have the code to run stand alone tests and I would like to add it to the existing code from circuito, but I’m not sure how. I’m sure I need to add a tab or 2, thats what confuses me I guess. Any help would be appreciated.

1 Like

Hi,
Don’t let the tabs confuse you - tabs are just files that are located in the same folder.
Your sketch, as provided by circuito.io, is really a folder with firmware.ino being the main file that runs and defines the logic, while all the others are library or definition files for each individual component that declare what are the functions you can do with each component.

So,
If you have a library for the SEN0159 Co2 - the library needs to be added to your sketch - either via an import function in your IDE, or just by adding the library files (unzipped) into the folder provided to you by circuito.

If there is no separate library, because the code relies on standard Arduino libraries, you don’t need to do all that and just insert all the rows from the separate sample code in the adequate places in your firmware.ino.

This means:

  • declare the pins for the sensor in the pin definitions
  • perform any setup in the setup function, which will initialize the sensor or variables.
  • add to the loop the rows that are actually reading input from the sensor.

Let us know how it goes?

Cheers,
Yana.