-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBaseSensor.h
More file actions
45 lines (28 loc) · 1.02 KB
/
BaseSensor.h
File metadata and controls
45 lines (28 loc) · 1.02 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
// Copyright © 2018 Stanislav Hnatiuk. All rights reserved.
#ifndef BASESENSOR_H
#define BASESENSOR_H
#include <Arduino.h>
const uint8_t sensorsMaxNum = 10;
// Базовый класс датчиков.
class BaseSensor {
public:
//! Вернуть адресс указанного датчика.
virtual char* getAddr(const uint8_t sensor) const;
//! Вернуть значение указанного датчика.
virtual float getValue(const uint8_t sensor) const;
//! Считать значение датчика.
virtual void read() = 0;
//! Вернуть количество датчиков
uint8_t getCount() const { return count; }
protected:
BaseSensor();
//! Количество датчиков.
uint8_t count;
//! Номер текущего датчика.
uint8_t index;
//! Адреса датчиков.
char** addr;
//! Значения датчиков.
float* data;
};
#endif // BASESENSOR_H