User Tools

Site Tools


arduino:encoder

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
arduino:encoder [2019/09/19 23:54] – created aistisarduino:encoder [2019/09/28 19:33] (current) – aistis
Line 1: Line 1:
 EC12-type encoder  EC12-type encoder 
 +
 +https://www.aliexpress.com/item/32748889074.html?spm=a2g0s.9042311.0.0.27424c4dV7N7fL
  
 {{:arduino:pasted:20190919-235422.png}} {{:arduino:pasted:20190919-235422.png}}
 +
 +{{:arduino:pasted:20190928-182343.png}}
 +
 +<code c++>
 +const int pinA = 2;
 +const int pinB = 3;
 +
 +void setup() {
 +  Serial.begin(115200);
 +  pinMode(pinA, INPUT_PULLUP);
 +  pinMode(pinB, INPUT_PULLUP);
 +}
 +
 +void loop() {
 +  Serial.print(digitalRead(pinA));
 +  Serial.print(",");
 +  Serial.print(digitalRead(pinB));
 +  Serial.println();
 +  delay(10);
 +}
 +</code>
 +
 +
 +
 +using lib: https://github.com/PaulStoffregen/Encoder
 +
 +<code>
 +#include <Encoder.h>
 +Encoder knobLeft(8, 9);
 +void setup() {
 +  Serial.begin(115200);
 +}
 +void loop() {
 +  Serial.println(knobLeft.read());
 +}
 +</code>
 +
 +{{:arduino:pasted:20190928-193355.png}}
arduino/encoder.1568926463.txt.gz · Last modified: by aistis