Example Code for Arduino-Gas Detection

Last revision 2026/01/15

Wiring Diagram

Analog Gas Sensor

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);
}

Result

Sen0127_result_pic.png

Was this article helpful?

TOP