2 * Example for using GP2Y1010AU0F Dust Sensor library
3 * Created by Mickey Chan
4 * library from https://github.com/mickey9801/GP2Y1010AU0F
7 #include <GP2Y1010AU0F.h>
9 int measurePin = A0; // Connect dust sensor analog measure pin to Arduino A0 pin
10 int ledPin = 2; // Connect dust sensor LED pin to Arduino pin 2
12 GP2Y1010AU0F dustSensor(ledPin, measurePin); // Construct dust sensor global object
16 //Serial.println(F("GP2Y1010AU0F Dust Sensor Library Example"));
23 float dustDensity = 0;
29 for (x = 0; x < samples; x++) {
31 dustDensity += dustSensor.read();
32 delay( 1000 / samples );
36 Serial.print("Dust_Density=");
37 Serial.println(dustDensity / samples);