From 0a297954a0403e7ad37f8dba18b6c9705833dcfe Mon Sep 17 00:00:00 2001 From: August Quint <49277349+AugustQu@users.noreply.github.com> Date: Tue, 21 Jan 2020 14:47:13 +0100 Subject: [PATCH] initial --- lib/SDS011/src/SDS011.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lib/SDS011/src/SDS011.h diff --git a/lib/SDS011/src/SDS011.h b/lib/SDS011/src/SDS011.h new file mode 100644 index 00000000..f8a013d5 --- /dev/null +++ b/lib/SDS011/src/SDS011.h @@ -0,0 +1,40 @@ +// SDS011 dust sensor PM2.5 and PM10 +// --------------------------------- +// +// By R. Zschiegner (rz@madavi.de) +// April 2016 +// +// Documentation: +// - The iNovaFitness SDS011 datasheet +// + +#if ARDUINO >= 100 + #include "Arduino.h" +#else + #include "WProgram.h" +#endif + +#include + +// Definition SDS011 sensor 'commands' +#define SDS_START_CMD 1 +#define SDS_STOP_CMD 2 +#define SDS_CONTINUOUS_MODE_CMD 3 +#define SDS_VERSION_DATE_CMD 4 + +class SDS011 { + public: + SDS011(void); + void begin(uint8_t pin_rx, uint8_t pin_tx); + void begin(HardwareSerial* serial); + void begin(SoftwareSerial* serial); + int read(float *p25, float *p10); + void sleep(); + void wakeup(); + void contmode( int ); + private: + void SDS_cmd(const uint8_t); + uint8_t calcChecksum( byte *); + uint8_t _pin_rx, _pin_tx; + Stream *sds_data; +};