I developed application that uses BlinkStick .NET and works fine on Win7.
I installed Mono on Raspberry Pi 3 and without LED strip connected can run it fine.
However when I connect BlinkStrip it throws exception when it gets to device.SetColors:
try
{
device = BlinkStick.FindFirst();
if (device != null)
{
if (device.OpenDevice())
{
// set color initially to green
byte[] data = SetColorArray(0, 0, 255, false); // brg
device.SetColors(0, data);
}
}
mCurrentState = State.Green;
picBox.Image = semaphorImageList.Images["green.png"];
timerLabel.Text = greenCountMax.ToString();
// start timer
colorTimer.Tick += colorTimer_Tick;
colorTimer.Start();
}
catch (Exception ex)
{
Log.Verbose(ex);
MessageBox.Show("Unable to find Blinkstick device. Verify that the device is connected.");
mCurrentState = State.None;
if (device != null)
{
device.CloseDevice();
device.Dispose();
}
colorTimer.Stop();
colorTimer.Tick -= colorTimer_Tick;
timerLabel.Text = "";
}
Another strange part is the when exception is caught it supposed to display message box but it does not…
After the exception the app frame can be moved but content of the window is not updated as it is gone…
Here is the stack:
{MainForm.Start: entered
{MainForm.SetColorArray: entered
}MainForm.SetColorArray: exiting
Exception type: System.NullReferenceException
Message: Object reference not set to an instance of an object
Source: HidSharp
StackTrace:
at HidSharp.LibusbHidStream.SetFeature (System.Byte[] buffer, System.Int32 offset, System.Int32 count) <0x72703d30 + 0x001b0> in :0
at HidSharp.HidStream.SetFeature (System.Byte[] buffer) <0x72703ca0 + 0x0004f> in :0
at (wrapper remoting-invoke-with-check) HidSharp.HidStream:SetFeature (byte[])
at BlinkStickDotNet.BlinkStick.SetFeature (System.Byte[] buffer) <0x72703930 + 0x0005b> in :0
at BlinkStickDotNet.BlinkStick.SetColors (System.Byte channel, System.Byte[] colorData) <0x727035d8 + 0x001d7> in :0
at TrafficBlink.MainForm.Start () <0x72d51918 + 0x000fb> in :0
Somebody told me that the USB driver is not installed or not installed correctly and pointed me to this link:
https://www.blinkstick.com/help/raspberry-pi-integration
But my build is done with BlinkStick .NET so I don’t see how Python version is relevant here…
Any feedback is greatly appreciated…
P.S. I installed Python as specified in the above link but the results are the same…