feat:encoder with existing lib (#2)

Co-authored-by: Clement <c.boesmier@aptatio.com>
Reviewed-on: #2
This commit is contained in:
2023-10-20 18:32:17 +02:00
parent 6e2da886fc
commit 3a6d55c646
19 changed files with 1943 additions and 8 deletions

View File

@ -0,0 +1,29 @@
/* Encoder Library - Basic Example
* http://www.pjrc.com/teensy/td_libs_Encoder.html
*
* This example code is in the public domain.
*/
#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(9600);
Serial.println("Basic Encoder Test:");
}
long oldPosition = -999;
void loop() {
long newPosition = myEnc.read();
if (newPosition != oldPosition) {
oldPosition = newPosition;
Serial.println(newPosition);
}
}