Skip to content

Commit

Permalink
Create SimpleEncoderDemo.ino
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus authored Oct 26, 2022
1 parent bf1cb3f commit b6750f4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions examples/SimpleEncoderDemo/SimpleEncoderDemo.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <ESP32Encoder.h> // https://github.com/madhephaestus/ESP32Encoder.git

#define CLK 13 // CLK ENCODER
#define DT 15 // DT ENCODER

ESP32Encoder encoder;

void setup () {
encoder.attachHalfQuad ( DT, CLK );
encoder.setCount ( 0 );
Serial.begin ( 115200 );
}

void loop () {
long newPosition = encoder.getCount() / 2;
Serial.println(newPosition);
}

0 comments on commit b6750f4

Please sign in to comment.