blob: ebe21f171b6ed316c067c3d8369b533b3ade7f6d (
plain)
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
|
/*
AnalogEncoder.h - RepRap Encoder library for Arduino
This library is used to interface with an Austria Microsystems magnetic encoder in analog mode.
History:
* Created intiial library (0.1) by Zach Smith.
*/
// ensure this library description is only included once
#ifndef AnalogEncoder_h
#define AnalogEncoder_h
// include types & constants of Wiring core API
#include "WConstants.h"
// library interface description
class AnalogEncoder {
public:
// constructors:
AnalogEncoder();
AnalogEncoder(int pin);
//our interface methods
void readState();
int getPosition();
int getDirection();
int version();
private:
int pin; //the switch state pin.
int current_position; //the current position on last read.
int last_position; //the position before our current read.
int direction; //the direction the encoder is moving.
};
#endif
|