edge lab LIVE! starts Tuesday in Munich. Grab a workshop seat and take home the board you build on. Code FRIEND-HACKSTER saves 20%. () Learn more!
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,624
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
0 projects • 1 follower

Comments