mathertel / RotaryEncoder

RotaryEncoder Arduino Library
Other
328 stars 107 forks source link

request: set steps per revolution and relevant example how to use this #14

Closed Ryder17z closed 4 years ago

Ryder17z commented 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.
mathertel commented 4 years ago

Maybe you can give more insights into what you like to achieve.

Ryder17z commented 4 years ago

I wanted to try enhance the reliability of an encoder by using steps per revolution at the time