9206| 6
|
[已解决] (SKU:SEN0177)PM2.5激光粉尘传感器的Demo代码注释错误 |
#include "Arduino.h" #include "serialReadPMValue.h" uint16_t PM2_5Value=0; //define PM2.5 value of the air detector module #define receiveDatIndex 32 uint8_t receiveDat[receiveDatIndex]; //receive data from the air detector module #include <LiquidCrystal.h> LiquidCrystal lcd(8, 9, 4, 5, 6, 7); void setup() { Serial.begin(9600); //set the serial's Baudrate of the air detector module lcd.begin(16, 2); } void loop(){ lcd.setCursor(0, 0); // set the LCD cursor position int length = serialRead(Serial,receiveDat,receiveDatIndex,5); //change the serial port:Serial1,Serial2.. int checkSum=checkValue(receiveDat,receiveDatIndex); if(length&&checkSum) { PM2_5Value=transmitPM2_5(receiveDat);//count PM2.5 value of the air detector module } static unsigned long OledTimer=millis(); //every 0.5s update the temperature and humidity from DHT11 sensor if (millis() - OledTimer >=1000) { OledTimer=millis(); lcd.print("pm2.5: "); lcd.print(PM2_5Value); lcd.print(" ug/m3"); Serial.print("PM2.5: "); //send PM1.0 data to bluetooth Serial.print(PM2_5Value); Serial.println(" ug/m3"); } } |
int length = serialRead(Serial,receiveDat,receiveDatIndex,5); 上面这句,最后那个",5"是什么意思? |
hnyzcj 发表于 2015-11-4 06:12 “data to bluetooth”? 哪里有蓝牙? |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed