-
Notifications
You must be signed in to change notification settings - Fork 0
/
Sensor.cpp
60 lines (56 loc) · 2.06 KB
/
Sensor.cpp
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
#include "Sensor.h"
#include <Arduino.h>
Sensor::Sensor(int gp, int adcPin, int gain)
{
m_guidePoint = gp;
m_adcPin = adcPin;
m_gain = gain;
}
/***************************************************************************************
** Function name: setGuidePoint
** Description: Set guide point of the sensor
***************************************************************************************/
void Sensor :: setGuidePoint(int gp)
{
m_guidePoint = gp;
}
/***************************************************************************************
** Function name: getGuidePoint
** Description: Get guide point of the sensor
***************************************************************************************/
int Sensor :: getGuidePoint()
{
return m_guidePoint;
}
/***************************************************************************************
** Function name: setGain
** Description: Set gain of the sensor
***************************************************************************************/
void Sensor :: setGain(int gain)
{
m_gain = gain;
}
/***************************************************************************************
** Function name: getGain
** Description: Get gain of the sensor
***************************************************************************************/
int Sensor :: getGain()
{
return m_gain;
}
/***************************************************************************************
** Function name: getData
** Description: Get ADC data of the sensor
***************************************************************************************/
int Sensor :: getData()
{
return analogRead(m_adcPin);
}
/***************************************************************************************
** Function name: setData
** Description: Set ADC data of the sensor
***************************************************************************************/
void Sensor :: setData(int data)
{
m_data = data;
}