-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsensor.h
More file actions
31 lines (25 loc) · 737 Bytes
/
sensor.h
File metadata and controls
31 lines (25 loc) · 737 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
#pragma once
#include <Arduino.h>
class Sensor;
extern Sensor GSensor;
class Sensor
{
enum Level : byte
{
Medium, /* PINB: 0bxxxxxx00 == 0 (PB0: 0, PB1: 0) */
Low, /* PINB: 0bxxxxxx01 == 1 (PB0: 1, PB1: 0) */
High, /* PINB: 0bxxxxxx10 == 2 (PB0: 0, PB1: 1) */
Unknown, /* PINB: 0bxxxxxx11 == 3 (PB0: 1, PB1: 1) */
NLevels
};
Level _level, _newLevel;
static constexpr unsigned long _interval = 1000UL, _reminderInterval = 10000UL;
unsigned long _millis, _reminderMillis;
bool _reminderSet;
public:
Sensor();
static void setup();
static void loop(unsigned long millis);
void CheckLevel(Level level, unsigned long millis);
void CheckReminder(unsigned long reminderMillis);
};