diff --git a/examples/SimpleEncoderDemo/SimpleEncoderDemo.ino b/examples/SimpleEncoderDemo/SimpleEncoderDemo.ino new file mode 100644 index 0000000..eb9972d --- /dev/null +++ b/examples/SimpleEncoderDemo/SimpleEncoderDemo.ino @@ -0,0 +1,17 @@ +#include // 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); +}