Skip to content

Commit

Permalink
encoder test sketch
Browse files Browse the repository at this point in the history
  • Loading branch information
dan9thsense committed Jun 8, 2012
1 parent d9a7135 commit cb73707
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions EncoderTest/EncoderTest.ino
@@ -0,0 +1,25 @@
//Encoders

#include <Encoder.h>

// Change these two numbers to the pins connected to your encoder.
// Best Performance: both pins have interrupt capability
// Good Performance: only the first pin has interrupt capability
// Low Performance: neither pin has interrupt capability
Encoder myEnc(5, 6);
// avoid using pins with LEDs attached

void setup() {
Serial.begin(115200);
Serial.println("Basic Encoder Test:");
}

long oldPosition = -999;

void loop() {
long newPosition = myEnc.read();
if (newPosition != oldPosition) {
oldPosition = newPosition;
Serial.println(newPosition);
}
}

0 comments on commit cb73707

Please sign in to comment.