sds011 - 먼지 센서

arduino_2017. 9. 21. 20:44

참고 사이트 : http://brtech.tistory.com/52



# include <SDS011.h>

float data1 = 0.0;

float data2 = 0.0;

int error;

SDS011 my_sds;

void setup() {

  // put your setup code here, to run once:

  my_sds.begin(6,7); // RXD, TXD

  Serial.begin(9600);

  Serial.println("Initialized complete");

}


void loop() {

  // put your main code here, to run repeatedly:

  error = my_sds.read(&data1, &data2);

  if(!error) {

    Serial.println("data1: " + String(data1));

    Serial.println("data2: " + String(data2));

  }

  delay(1000); // 1 seconds

}

'arduino_' 카테고리의 다른 글

LED _VER2 FOUR  (0) 2017.10.10
four led  (0) 2017.10.10
데이터 사이즈  (0) 2017.09.21
10개만 출력  (0) 2016.03.26
illumination_sensor (조도센서)  (0) 2016.02.13