-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElectroSensor.h
More file actions
39 lines (32 loc) · 765 Bytes
/
Copy pathElectroSensor.h
File metadata and controls
39 lines (32 loc) · 765 Bytes
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
/*
* -Electric Sensing Library-
*
* this header file for Electric Sensing Library
*
* author jihoonkimtech (jihoonkimtech@naver.com)
* (Republic of Korea)
* version V0.0.1
*/
#ifndef _ElectroSensor_H_
#define _ElectroSensor_H_
#include "Arduino.h"
enum sensType { CURRENT, VOLTAGE };
enum unitType { MILLI, NORMAL, KILO };
class ElectroSensor {
public :
ElectroSensor(int type, int pin);
void printVoltage(char lastChr = '\n');
double readVoltage(int unit = NORMAL);
void printCurrent(char lastChr = '\n');
double readCurrent(int unit = NORMAL);
private :
int _pin;
double _voltage;
double _current;
double _res1;
double _res2;
double _analogRes = 1024.0;
double _multiple = 5.0;
double _curChange = 0.185;
};
#endif