Having a problem with a new Rotary H1 Module - something I haven’t used before but in theory is super simple - direction and counts.
My problem is I can read direction but not counts. My configuration is a FEZ Cobra II Net with 2 line character display connected to Socket 1 and the Rotary H1 connected to Socket 3. Compiled to target .net micro framework 4.2.
The unit is powered by a quality external 12V DC supply and connected to my development system via USB.
I have distilled the code down as below - I know its not pretty but served to eliminate everything else!.
It displays “up - 0” when I turn in a clockwise direction and
"down - 0" when turned anticlockwise.
Checking the counts variable in debug confirms is has read 0.
Any thoughts or suggestions would be appreciated.
Public Sub ProgramStarted()
Dim counts As Integer Dim display_string As String char_Display.Clear() Debug.Print("Program Started") While 2 > 1 char_Display.Clear() counts = rotaryH1.GetCount() If rotaryH1.GetDirection = GTM.GHIElectronics.RotaryH1.Direction.Clockwise Then display_string = "up - " + counts.ToString Else display_string = "down - " + counts.ToString End If char_Display.PrintString(display_string) Thread.Sleep(500) End While