int CLK = 2;
int DT =5;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(CLK, INPUT);
pinMode(DT, INPUT);
}
int last = HIGH;
void loop() {
// put your main code here, to run repeatedly:
int clkval = digitalRead(CLK);
if(last != clkval){
last = clkval;
int dtval = digitalRead(DT);
if(clkval == LOW && dtval == HIGH){
Serial.println("Clockwise Rotation ►");
}
if(clkval == LOW && dtval == LOW){
Serial.println("Anti-Clockwise Rotation ");
}
}
}