Loom 4 v4.5
Arduino library for Internet of Things Rapid Prototyping in environmental sensing
Loading...
Searching...
No Matches
Loom_K30.h
1#pragma once
2
3#include <Wire.h>
4#include "wiring_private.h"
5
6#include "Loom_Manager.h"
7#include "../I2CDevice.h"
8
9
16class Loom_K30 : public I2CDevice{
17 protected:
18 void power_up() override {};
19 void power_down() override {};
20
21
22 // Manager controlled functions
23 void measure() override;
24 void initialize() override;
25 void package() override;
26 public:
36 Manager& man,
37 bool useMux = false,
38 int addr = 0x68,
39 bool warmUp = true,
40 int valMult = 1
41 );
42
46 int getCO2() { return CO2Levels; };
47
48 private:
49 Manager* manInst; // Instance of the manager
50
51 int addr; // Address of the I2C sensor
52
53 int CO2Levels; // Current CO2 levels of the sensor
54
55 int valMult; // Return value multiplier
56 bool warmUp; // Should we wait 6 mins for warm up to get accurate results
57 bool hasWarmedUp = false;
58
59 byte buffer[4] = {0, 0, 0, 0}; // Buffer to store data read from the sensor
60
61 byte read_CO2[7] = {0xFE, 0X44, 0X00, 0X08, 0X02, 0X9F, 0X25}; // Command packet to read Co2 (see app note)
62 byte sensor_response[7] = {0, 0, 0, 0, 0, 0, 0}; // create an array to store the response
63
64 bool verifyChecksum(); // Verify the checksum for the data is correct
65 void getCO2Level(); // Request the CO2 Level from the sensor
66};
Definition: I2CDevice.h:6
Definition: Loom_K30.h:16
int getCO2()
Definition: Loom_K30.h:46
Definition: Loom_Manager.h:18