Encoder Driver

Are any known issues with the EncoderController that is part of the standard driver library.

Using pins PE7 and PE8, there is no indication of rotation. Code is shown below. Builds and executes with no errors.

using System;
using System.Diagnostics;

using GHIElectronics.TinyCLR.Devices.Gpio;
using GHIElectronics.TinyCLR.Pins;

using GHIElectronics.TinyCLR.Drivers.Encoder;
using System.Threading;

namespace TestEncoder
internal class Program
static void Main()
var gpioController = GpioController.GetDefault();
var pinA = gpioController.OpenPin(FEZFeather.GpioPin.PE7);
var pinB = gpioController.OpenPin(FEZFeather.GpioPin.PE8);

  var encoder = new EncoderController(pinA, pinB);

  encoder.OnCounterChangedEvent += (counter) =>
    Debug.WriteLine("Counter = " + counter);



we will check

Just tested it, it works very well on mine.

I’m using PB4 and and PB5, but it doesn’t matter what pins are.

make sure connection is correct.

My module has GND in middle.

Firmware latest:

I am using a Fez Feather, this encoder was checked for use and is working with a non-fez device. I have attached the project to see if I am missing something. I have verified ground to the middle of the device

Hope that helps

Also make variable cnt++ in a loop to make sure your code is deployed and running.

Bad encoder, actually 2 out of 5. Thanks for the quick reply.

1 Like