Library to manage Inovafitness SDS021 particles sensor
Dependents: LoRaWAN-demo-72-bootcamp SDS021Test
Diff: Sds021.h
- Revision:
- 1:fb3d61ffd503
- Parent:
- 0:0c1a6a29b8c4
- Child:
- 2:49822e10d111
--- a/Sds021.h Sat Jan 28 11:31:02 2017 +0000 +++ b/Sds021.h Sat Jan 28 15:30:53 2017 +0000 @@ -31,7 +31,7 @@ #include "BufferedSerial.h" -class SDS21 +class SDS021 { public: /* public structures and constants */ @@ -43,7 +43,7 @@ public: - SDS21(PinName tx=D8, PinName rx=D2) : _sds021(tx, rx), _PM2_5(0), _PM10(0), _mode(false), _state(true), _interval(0), _id(0xffff) { + SDS021(PinName tx=D8, PinName rx=D2) : _sds021(tx, rx, 9600), _PM2_5(0), _PM10(0), _mode(false), _state(true), _interval(0), _id(0xffff) { _firmware.year = 0; } bool update(); @@ -118,7 +118,7 @@ char outMessage[kOutputLength]; char inMessage[kInputLength]; - char* prepareMessage(SDS21::action_t action, bool set = 0, int address = 0xFFFF, int value = 0); + char* prepareMessage(SDS021::action_t action, bool set = 0, int address = 0xFFFF, int value = 0); char calcCheckSum(char* buffer, int start_idx, int stop_idx); bool checkSum(char* buffer, int start_idx = 2, int stop_idx = 8); void writeMessage(char* buffer);