19 lines
288 B
C++
19 lines
288 B
C++
#include <Encoder.h>
|
|
|
|
long last_position = 0;
|
|
|
|
Encoder myEnc(2, 3); // pins for A and B
|
|
|
|
void setup() {
|
|
Serial.begin(9600);
|
|
}
|
|
|
|
void loop() {
|
|
long position = myEnc.read();
|
|
if(position != last_position){
|
|
last_position = position;
|
|
Serial.println(position);
|
|
}
|
|
delay(100);
|
|
}
|