標題: MQ-135 [打印本頁]
作者: 18677304384 時間: 2017-7-5 18:27
標題: MQ-135
1. #define Aout A0 //MQ-135 AO 接 Arduino Uno A0
2.
3. int temp = 0; //臨時變量,存儲A0讀取的數據
4.
5. void setup() {
6. // put your setup code here, to run once:
7. Serial.begin(9600);//定義波特率
8. pinMode(Aout, INPUT);//定義A0為INPUT模式
9. }
10.
11. void loop() {
12. // put your main code here, to run repeatedly:
13. temp = analogRead(Aout); //讀取A0的模擬數據
14. Serial.println(temp); //串口輸出temp的數據
15. delay(600); //延時500毫秒
16. }
| 歡迎光臨 (http://www.denmoz.com/bbs/) |
Powered by Discuz! X3.1 |