-
Notifications
You must be signed in to change notification settings - Fork 53
/
SDS011.h
44 lines (39 loc) · 795 Bytes
/
SDS011.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// SDS011 dust sensor PM2.5 and PM10
// ---------------------------------
//
// By R. Zschiegner ([email protected])
// April 2016
//
// Documentation:
// - The iNovaFitness SDS011 datasheet
//
#ifndef __SDS011_H
#define __SDS011_H
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#ifndef ESP32
#include <SoftwareSerial.h>
#endif
class SDS011 {
public:
SDS011(void);
#ifndef ESP32
void begin(SoftwareSerial* serial);
void begin(uint8_t pin_rx, uint8_t pin_tx);
#endif
#ifdef ESP32
void begin(HardwareSerial* serial);
void begin(HardwareSerial* serial, int8_t pin_rx, int8_t pin_tx);
#endif
int read(float *p25, float *p10);
void sleep();
void wakeup();
void continuous_mode();
private:
uint8_t _pin_rx, _pin_tx;
Stream *sds_data;
};
#endif