Device.TurnOff(); method does not seem to function with .net API and FlexStrip


in the code below, I slightly modified the examples from the example, this sets the first LED to white, then attempts to turn the device off, then I set the color to green.

the device, turns on white, then green, no exceptions thrown.

        public static void Main (string[] args)
        BlinkStick device = BlinkStick.FindFirst ();

        if (device != null) {
            if (device.OpenDevice ()) {
                device.SetMode (2);
            } else {
                Console.WriteLine ("Could not open the device");
        } else {
            Console.WriteLine ("BlinkStick not found");

LinkPad Shared Code


It seems you try to send the signals to fast to the device. Try a sleep after any Set… and the TurnOff like



Putting the thread to sleep for upwards of a second, still has no effect. Could this be an issue with the FlexStrip controller?


First of all a sorry for the wrong code, it should be something like this of course:


You need at least 20 ms delay between signals.

I´ve tested your code and it does: white-off-green very fast. What exactly are you gonna do?


I believe the issue is in the SDK, this will from my understanding, and testing only turn off the first LED, and it doesn’t actually turn off the device, it just sets the color to black. After reviewing many of the functions in the API, it doesn’t look like the majority of them have been adapted for use with Multiple LEDs, is that accurate?

  public void TurnOff()
      SetColor(0, 0, 0);

should be something like

	public void TurnOff() {
	 int numberOfLeds = 0;
	 numberOfLeds = device.GetLedCount(); //this at times has thrown exeception for being unable to retrive count.
	 if (numberOfLeds > 0) 
	  for (byte i = 0; i < numberOfLeds; i++) 
	   device.SetColor(0, i, 0);
	   Thread.Sleep(20); //would rather avoid thread sleep, implement OnReceiveColor per index


Ah, now I understand:
You cannot TurnOff a complete device like flex because the SDK does not know how many LEDs you have connected. The amout of LEDs attached to a flex could be variable.

Please find the post here how to solve this:

Set all your LEDs to off with the very fast Set_Colors function.


I suggest then that the API be updated to something like this.

public void TurnOff()
  int numberOfLeds = 0;
  numberOfLeds = device.GetLedCount();
  byte[] data = new byte[numberOfLeds * 3]; //each LED has 3 bytes of data (GRB), default for new byte array is 0 all zeros is black, or off

This should get a count of the LEDs, and produce 3 bytes per, of 0, setting all to black.

I don’t have the device in front of me at the moment, so anyone able to double check this?


@bruce thanks for the suggestion. Will have it implemented in the next release. It’s a bit more complicated as all devices have to be supported, but I have this implemented in the client application so it should be no problem to port it to the library.