New librarie for rotary encoders

Hi,
QuadEncoder is a new library I wrote yesterday. I made it available at GitHub - medecau/QuadEncoder: Library for reading moves from a quadratic rotary encoder.
I thought it might be helpful to link from the playground.

One question:
What does hb mean?

hb is short for heartbeat.

hb() has to be called has frequently has possible to maintain accuracy.
it returns a char ‘>’ or ‘<’ when moved and ‘-’ when idle.

I tried to use integers 1, -1 and 0 but for some reason it did not work.

Arduinolibraries usually write functionnames in its full verbose beautiful entirety.
Maybe you could rename your function to hartbeat() ?

Just a friendly suggestion :]

This is really cool! However, you are going to miss counts when using a ‘high resolution’ encoder at ‘high speeds’.

I solved this by using interrupts (as described on the playground) and by using some low level hacking. For example:

...
// Every pulse from the encoder is counted by means of an interrupt. Counting is done by looking at a change from LOW to HIGH
  // (RISING) or from HIGH to LOW (FALLING). Resolution is doubled by looking at every change (CHANGE). The resolution is again
  // doubled by using two interrupts and looking at both channels. Limiting factor is the maximum counts per seconde (20000).
  // Interrupt0 -> pin 2, Interrupt1 -> pin3.
  attachInterrupt(0, doEncoder0, RISING);


...

// Everytime a change happens on encoder pin A doEncoder0 will run. Because of performance direct port I/O is used instead of
// digitalRead.
void doEncoder0(){
  if (PIND&(1<<2) == (PIND&(1<<4))>>2){
    EncoderCount++;
  }
  else {
    EncoderCount--;
  }
}

It would be nice to have options so that the user can choose between non-interrupt and interrupt-mode, between using 1 or 2 interrupts and between the sort of change (rise, fall or both). Do you think it is possible to include this in your library?