作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何使用带 Arduino 的 MQ135 查找 Co2 和 O2 水平或任何其他参数,我只是感应 ppm 数据并将其显示在屏幕上。
int sensorValue;
int pin8 = 8;
void setup()
{
Serial.begin(9600); // sets the serial port to 9600
pinMode(pin8, OUTPUT);
}
void loop()
{
sensorValue = analogRead(0); // read analog input pin 0
Serial.print(sensorValue, DEC); // prints the value read
Serial.println("ppm");
if (sensorValue > 500) {
// Activate digital output pin 8 - the LED will light up
digitalWrite(pin8, HIGH);
}
else {
// Deactivate digital output pin 8 - the LED will not light up
digitalWrite(pin8, LOW);
}
delay(5000); // wait 100ms for next reading
}
最佳答案
我发现,如果您是第一次使用传感器,最好先将其开机约 24 小时,然后再进行良好读取。不要跳过这一步。
然后是校准过程。只需校准它,在良好的空气条件下从 analogRead 获得大约 100-150。
正常回风~100-150
酒精返回 ~700
打火机气体返回 ~750+
编辑:
刚注意到这个Arduino library for the MQ135这可能会有帮助。
edit2:
我决定也更新我的代码并找到 this great source .你可以找到所有代码 here .
关于arduino-uno - 如何使用带 Arduino 的 MQ135 查找二氧化碳和氧气水平,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31109021/
我是一名优秀的程序员,十分优秀!