Fc-22 Gas sensor Arduino: Difference between revisions

From wikiluntti
Line 6: Line 6:


<syntaxhighlight lang="C">
<syntaxhighlight lang="C">
#include "MQ135.h"
MQ135 gasSensor = MQ135(A5);
int ppm = gasSensor.getPPM();
void setup() {
  Serial.begin(9600);
}
void loop() {
  float rzero = gasSensor.getRZero();
  float ppm = gasSensor.getPPM();
  Serial.println(ppm);
  delay(1000);
}
</syntaxhighlight >
</syntaxhighlight >


== Exercises ==
== Exercises ==

Revision as of 17:59, 18 November 2024

Introduction

MQ-2

Theory

#include "MQ135.h"

MQ135 gasSensor = MQ135(A5);

int ppm = gasSensor.getPPM();

void setup() {
  Serial.begin(9600);
}

void loop() {
  float rzero = gasSensor.getRZero();
  float ppm = gasSensor.getPPM();
  Serial.println(ppm);

  delay(1000);
}

Exercises

Code 1

Code 2

Code 3