-
Notifications
You must be signed in to change notification settings - Fork 10
/
autoPOT.h
46 lines (37 loc) · 1.1 KB
/
autoPOT.h
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
#ifndef autoPOT_h
#define autoPOT_h
#include <idlers.h>
//****************************************************************************************
// autoPOT:
// autoPOT is a quick and easy way to get analog readings from the analog port. When the
// reading changes, your callback is called, giving you the new value.
//
// Create an autoPOT instance using the analog input pin number of your choice.
// autoPOT myPOT(A0);
//
// In your setup() function, attach this to your callback function.
// myPOT.setCallback(gotChange);
//
// Write your callback function.
// void gotChange(int newValue) {
// Do stuff with the newValue
// }
//
// Make sure idle() is called in your main loop() function.
//
// That's about it.
//****************************************************************************************
class autoPOT : public idler {
public:
autoPOT(int inPin);
virtual ~autoPOT(void);
void setCallback(void(*funct)(int));
void setWindow(int plusMinus);
virtual void idle(void);
protected:
void (*callback)(int);
int pinNum;
int value;
int window;
};
#endif