-
Notifications
You must be signed in to change notification settings - Fork 8
/
sfm3000wedo.h
49 lines (36 loc) · 1.2 KB
/
sfm3000wedo.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
45
46
47
48
49
/*
SFM3000wedo.cpp - Library for reading values from flowmeter Sensirion SFM3000wedo
https://www.sensirion.com/en/flow-sensors/mass-flow-meters-for-high-precise-measurement-of-gases/low-pressure-drop-mass-flow-meter/
Created by WeDo, Zuerich 20170616
Released into the public domain.
Pay attention to Scaling!!
int offset = 32000; // Offset for the sensor
float scale = 140.0; // Scale factor for Air and N2 is 140.0, O2 is 142.8
Flow = (readvalue - offset) / scale
*/
#ifndef SFM3000wedo_h
#define SFM3000wedo_h
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#include "pins_arduino.h"
#include "WConstants.h"
#endif
class SFM3000wedo {
public:
//SFM3000wedo(uint8_t i2cAddress);
SFM3000wedo(int i2cAddress);
void init();
float getvalue();
private:
//uint8_t mI2cAddress;
int mI2cAddress;
uint8_t crc8(const uint8_t data, uint8_t crc);
};
// unsigned long _startTime;
// float _startValue; // Start from this value
// unsigned long _stopTime;
// float _stopValue; // Stop at this value
// float lerp(float m1, float M1, float m2, float M2, float v1);
#endif