Example Code for Arduino-Read CO Concentration

Last revision 2025/12/20

This article presents a step-by-step guide on using Arduino to read CO concentration, including hardware and software preparation, wiring diagrams, and sample code for effective implementation.

Wiring Diagram

Analog sensor connection diagram

Sample Code


///Arduino Sample Code
void setup()
{
  Serial.begin(9600); //Set serial baud rate to 9600 bps
}
void loop()
{
int val;
val=analogRead(0);//Read Gas value from analog 0
Serial.println(val,DEC);//Print the value to serial port
delay(100);
}

Was this article helpful?

TOP