-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathBatReader.h
More file actions
71 lines (54 loc) · 1.43 KB
/
BatReader.h
File metadata and controls
71 lines (54 loc) · 1.43 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/******************************************************************************
* Zowi Battery Reader Library
*
* @version 20150824
* @author Raul de Pablos Martin
*
******************************************************************************/
#ifndef __BATREADER_H__
#define __BATREADER_H__
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#include "pins_arduino.h"
#endif
////////////////////////////
// Definitions //
////////////////////////////
#define BAT_PIN A7
#define BAT_MAX 4.2
#define BAT_MIN 3.25
#define ANA_REF 5
#define SLOPE 100/(BAT_MAX - BAT_MIN)
#define OFFSET (100*BAT_MIN)/(BAT_MAX - BAT_MIN)
class BatReader
{
public:
////////////////////////////
// Enumerations //
////////////////////////////
////////////////////////////
// Variables //
////////////////////////////
////////////////////////////
// Functions //
////////////////////////////
// BatReader -- BatReader class constructor
BatReader();
// readBatPercent
double readBatVoltage(void);
// readBatPercent
double readBatPercent(void);
private:
////////////////////////////
// Enumerations //
////////////////////////////
////////////////////////////
// Variables //
////////////////////////////
////////////////////////////
// Functions //
////////////////////////////
};
#endif // BATREADER_H //