-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathIRSensor.h
More file actions
38 lines (29 loc) · 690 Bytes
/
IRSensor.h
File metadata and controls
38 lines (29 loc) · 690 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
#ifndef IRSENSOR_H
#define IRSENSOR_H
#include "Config.h"
#include <Arduino.h>
class IRSensor
{
public:
int threshold; //exclusive
int preSilenceRequired; //1 s
int postSilenceRequired; //1 s
int maxSequenceDuration; //1 s
short maxPeaksAllowed;
float peaksDistanceVariationAllowed; //ms
unsigned long lastSequenceStart;
unsigned long lastSequenceDuration;
unsigned long lastSilence;
unsigned long sequenceStart;
unsigned long peakTime;
unsigned long peakTimes[5];
int peaks;
int lastPeak;
IRSensor();
bool process(short sensor);
private:
bool _process(short sensor);
int peakDetection(int sensorValue);
void sendPlotData(String seriesName, int data);
};
#endif