-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
68bf4f4
commit 190701b
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Sharp GP2Y* Dust Sensor library | ||
|
||
Arduino compatible (ESP8266, ESP32, etc) library for the Sharp GP2Y dust sensors: | ||
- GP2Y1010AU0F | ||
- GP2Y1014AU0F | ||
|
||
**Features:** | ||
- multi-reading average | ||
- running average | ||
- runtime calibration | ||
- sensitivity setting | ||
- offset adjustment (zero dust value) | ||
|
||
**Example:** | ||
|
||
```c++ | ||
#include <GP2YDustSensor.h> | ||
|
||
const uint8_t SHARP_LED_PIN = 14; // Sharp Dust/particle sensor Led Pin | ||
const uint8_t SHARP_VO_PIN = A0; // Sharp Dust/particle analog out pin used for reading | ||
|
||
GP2YDustSensor dustSensor(GP2YDustSensorType::GP2Y1014AU0F, SHARP_LED_PIN, SHARP_VO_PIN); | ||
|
||
void setup() { | ||
Serial.begin(9600); | ||
//dustSensor.setBaseline(0.4); // set no dust voltage according to your own experiments | ||
//dustSensor.setCalibrationFactor(1.1); // calibrate against precision instrument | ||
dustSensor.begin(); | ||
} | ||
|
||
void loop() { | ||
Serial.print("Dust density: "); | ||
Serial.print(dustSensor.getDustDensity()); | ||
Serial.print(" ug/m3; Running average: "); | ||
Serial.print(dustSensor.getRunningAverage()); | ||
Serial.println(" ug/m3"); | ||
delay(1000); | ||
} | ||
``` |