mirror of
https://github.com/sigmasternchen/MH-Z-CO2-Sensors
synced 2025-03-15 14:48:55 +00:00
40 lines
516 B
C
40 lines
516 B
C
![]() |
/* MHZ library
|
||
|
|
||
|
By Tobias Schürg
|
||
|
*/
|
||
|
#ifndef MHZ_H
|
||
|
#define MHZ_H
|
||
|
|
||
|
#if ARDUINO >= 100
|
||
|
#include "Arduino.h"
|
||
|
#else
|
||
|
#include "WProgram.h"
|
||
|
#endif
|
||
|
|
||
|
|
||
|
// Define types of sensors.
|
||
|
#define MHZ14A 14
|
||
|
#define MHZ19B 19
|
||
|
|
||
|
|
||
|
#include <SoftwareSerial.h>
|
||
|
|
||
|
|
||
|
class MHZ {
|
||
|
public:
|
||
|
MHZ(uint8_t rxpin, uint8_t txpin, uint8_t pwmpin, uint8_t type);
|
||
|
|
||
|
int readCO2UART();
|
||
|
int readCO2PWM();
|
||
|
|
||
|
private:
|
||
|
uint8_t _rxpin, _txpin, _pwmpin, _type;
|
||
|
SoftwareSerial co2Serial;
|
||
|
byte getCheckSum(byte *packet);
|
||
|
|
||
|
};
|
||
|
|
||
|
|
||
|
#endif
|
||
|
|