-
Notifications
You must be signed in to change notification settings - Fork 2
/
Sensor.py
55 lines (36 loc) · 1004 Bytes
/
Sensor.py
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
"""
@author: Yehya SHARIF
This file defines an abstract class named "Sensor"
(parent class of all sensors used in the test bench)
With this class, we can create several of child sensors.
"""
import serial
class Sensor:
#Abstract Class
def __init__(self,port,baud):
"""
This function is to initialise an instance object of the class sensor
Returns
-------
None.
"""
# PARAM7TRES
self.port = port
self.baud = baud
#INIT
self.value = 0
self.ser = serial.Serial(self.port,self.baud)
def UpdateSensor(self,index):
pass
def get_value(self):
pass
def process(self):
"""
to return the desired measured value
Returns
-------
value: the measured value
"""
self.UpdateSensor()
value=self.get_value()
return value