Skip to content

Instantly share code, notes, and snippets.

@houmei
Created May 7, 2016 16:39
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
RotaryEncoder(Analog input)
const int analogInPin = A0; // Analog input pin that the potentiometer is attached to
int sensorValue = 0; // value read from the pot
int o,oo;
void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}
void loop() {
// read the analog in value:
sensorValue = analogRead(analogInPin);
o = (sensorValue)>>6;
if ( o!=oo ) {
Serial.println(o);
oo=o;
}
// delay(2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment