Rotary Encoder Video Tutorial with Arduino Code




Rotary Encoder Tutorial with Arduino Code

int pulses, A_SIG=0, B_SIG=1;

void setup(){
  attachInterrupt(0, A_RISE, RISING);
  attachInterrupt(1, B_RISE, RISING);
  Serial.begin(115200);
}//setup

void loop(){

}

void A_RISE(){
 detachInterrupt(0);
 A_SIG=1;

 if(B_SIG==0)
 pulses++;//moving forward
 if(B_SIG==1)
 pulses--;//moving reverse
 Serial.println(pulses);
 attachInterrupt(0, A_FALL, FALLING);
}

void A_FALL(){
  detachInterrupt(0);
 A_SIG=0;

For more detail: Rotary Encoder Video Tutorial with Arduino Code




This Post / Project can also be found using search terms:

  • arduino encoder tutorial
  • Arduino LCD Rotary Encoder
Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
DIY Arduino Mini BMO

BMO from Comedy Central’s Adventure Time is adorable, if only someone would make one that can walk! Atleast we can...

Close
Scroll to top