ELEDTROLED
Published © CC BY-ND

Smoke and Gas Sensor

In this project, we will use the MQ-02 sensor to detect smoke and gas.

BeginnerFull instructions provided3,542
Smoke and Gas Sensor

Things used in this project

Story

Read more

Schematics

schematic

Code

Smoke and gas sensor code

Arduino
to implement in the kitchen or workshop
int VALOR;
int AVISO = 2;
int VERDE = 3;

void setup() {
  pinMode(A0, INPUT);
  pinMode(AVISO, OUTPUT);
  pinMode(VERDE, OUTPUT);
}

void loop() {
  digitalWrite(VERDE, HIGH);
  VALOR = analogRead(A0 > 400);
  if(VALOR == 400) {
    digitalWrite(AVISO, HIGH);
    delay(500);
    digitalWrite(AVISO, LOW);
    delay(500);
  } 
  
}

Credits

ELEDTROLED

ELEDTROLED

0 projects • 1 follower

Comments