SparkFun Forums 

Where electronics enthusiasts find answers.

Search found 1 match

 Go to advanced search

Re: Arduino + rotary encoder

 by sazhapooh ¦  Sun Feb 28, 2010 10:41 pm ¦  Forum: Code ¦  Topic: Arduino + rotary encoder ¦  Replies: 8 ¦  Views: 40219

void loop() { state = (digitalRead(inp1) << 1) | digitalRead(inp2); if (state != prevstate) { prevstate = state; if(state==1){ if (state == nextEncoderState[prevstate]) { count++; } else if (state == prevEncoderState[prevstate]) { count--; } Serial.println(count); } } } have you declared your inp1 a...