Recieving error when trying to SetLedCount


#1

Hi

I have been having issues with a newly purchased BlinkStick Square setting the number of Led’s lit.

This was failing as part of my overall project so I stripped it and tried to simplify by updating an example. But no luck.

    static void Main(string[] args)
    {
        Console.WriteLine("Pulse test for BlinkStick.\r\n");
        
        BlinkStick device = BlinkStick.FindFirst();
        device.OpenDevice();

        try
        {
            device.SetLedCount(2);
        }
        catch (Exception ex)
        { Console.WriteLine(ex); }

        {

            device.Pulse("red");
            device.Pulse("green");
            device.Pulse("blue");
        }

The error recieved is:

System.IO.IOException: SetFeature failed. —> System.ComponentModel.Win32Exception: The parameter is incorrect
— End of inner exception stack trace —
at HidSharp.Platform.Windows.WinHidStream.SetFeature(Byte[] buffer, Int32 offset, Int32 count) in C:\Code\src\oss\hidsharp\HidSharp\Platform\Windows\WinHidStream.cs:line 134
at HidSharp.HidStream.SetFeature(Byte[] buffer) in C:\Code\src\oss\hidsharp\HidSharp\HidStream.cs:line 215
at BlinkStickDotNet.Usb.HidStreamAdapter.<>c__DisplayClass6_0.b__0()
at BlinkStickDotNet.Usb.HidStreamAdapter.RetryActionOnFail(UInt32 times, Action action)
at BlinkStickDotNet.Usb.HidStreamAdapter.SetFeature(Byte[] buffer)
at BlinkStickDotNet.BlinkStick.SetFeature(Byte[] buffer)
at BlinkStickDotNet.BlinkStick.SetLedCount(Byte count)
at ConsoleApp6.Program.Main(String[] args) in C:\Users\jchan\Documents\Visual Studio 2017\Projects\ConsoleApp6\ConsoleApp6\Program.cs:line 22

Any ideas?


#2

The answer was to setmode(3)