Encoder *e = new Encoder(1, 2); //1 & 2 = your dig io pins for channel a & b e->Start(); int distance = e->GetDistance(); // use distance for whatever you want