kevinzhang19701 发表于 2015-11-3 21:46:56

(SKU:SEN0177)PM2.5激光粉尘传感器的Demo代码注释错误

产品资料库内的(SKU:SEN0177)PM2.5激光粉尘传感器的演示代码的注释不对,望尽快修改。谢谢。

hnyzcj 发表于 2015-11-4 06:12:38

#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; //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");   
      
   
    }
}

hnyzcj 发表于 2015-11-4 06:11:58

不对那就看我的吧。

dsweiliang 发表于 2015-11-4 08:18:53

hnyzcj 发表于 2015-11-4 06:11
不对那就看我的吧。

不明觉厉

Cain 发表于 2015-11-4 11:01:44

已修改,谢谢提醒

kevinzhang19701 发表于 2015-11-4 11:02:55

int length = serialRead(Serial,receiveDat,receiveDatIndex,5);

上面这句,最后那个",5"是什么意思?

kevinzhang19701 发表于 2015-11-4 11:03:47

hnyzcj 发表于 2015-11-4 06:12
#include "Arduino.h"
#include "serialReadPMValue.h"
uint16_t PM2_5Value=0;         //define PM2.5 va ...

“data to bluetooth”?

哪里有蓝牙?
页: [1]
查看完整版本: (SKU:SEN0177)PM2.5激光粉尘传感器的Demo代码注释错误