Closed Ryder17z closed 4 years ago
i.e. 1 rotary encoder, 16 steps, 2 leds.
Psudo-code:
if(RevolutionStep < 4) // Pos 0-3 { digitalWrite(13, HIGH); // LED_BUILTIN digitalWrite(12, HIGH); // LED_EXTERNAL } else if(RevolutionStep >= 4 && RevolutionStep < 8) // Pos 4-7 { digitalWrite(13, HIGH); // LED_BUILTIN digitalWrite(12, LOW); // LED_EXTERNAL } else if(RevolutionStep >= 8 && RevolutionStep < 12) // Pos 8-11 { digitalWrite(13, LOW); // LED_BUILTIN digitalWrite(12, LOW); // LED_EXTERNAL } else if(RevolutionStep >= 12) // Pos 12-15 { digitalWrite(13, LOW); // LED_BUILTIN digitalWrite(12, HIGH); // LED_EXTERNAL } // 16 steps completed. One full revolution.
Maybe you can give more insights into what you like to achieve.
I wanted to try enhance the reliability of an encoder by using steps per revolution at the time
i.e. 1 rotary encoder, 16 steps, 2 leds.
Psudo-code: