找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 2144|回復: 0
收起左側(cè)

MQ-135

[復制鏈接]
ID:217444 發(fā)表于 2017-7-5 18:27 | 顯示全部樓層 |閱讀模式
1. #define Aout A0 //MQ-135 AO Arduino Uno A0  
2.   
3. int temp = 0; //臨時變量,存儲A0讀取的數(shù)據(jù)  
4.   
5. void setup() {  
6.   // put your setup code here, to run once:  
7.   Serial.begin(9600);//定義波特率  
8.   pinMode(Aout, INPUT);//定義A0INPUT模式  
9. }  
10.   
11. void loop() {  
12.   // put your main code here, to run repeatedly:  
13.   temp = analogRead(Aout); //讀取A0的模擬數(shù)據(jù)  
14.   Serial.println(temp); //串口輸出temp的數(shù)據(jù)  
15.   delay(600);  //延時500毫秒  
16. }  

回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網(wǎng)

快速回復 返回頂部 返回列表