Processing not recognizing BlinkStick Pro

I am having trouble using my BlinkStick Pro with Processing 3.0.2 I get a null pointer exception on the line that creates the BlinkStick object in the ProIndexedColors.pde example file. I have also tried it with Processing 2 with the same effect. The BlinkStick installed drivers when I first plugged it in.

Is there something I am missing and need to install?

Thanks in advance,
Eric


OS: Windows 10 Pro
Machine: Dell Inspiron 1545

Hey Eric,

welcome to the forums!

Could you please try a more simple example and tell us what happens:

import blinkstick.*;
BlinkStick led = BlinkStick.findFirst();

led.setColor(255, 0, 0);
delay(1000);
led.setColor(0, 255, 0);
delay(1000);
led.setColor(0, 0, 255);
delay(1000);
led.setColor(255, 255, 0);

I get the same error as before. I made the mistake of running this before plugging the BlinkStick in, and I got a different error. Rather than getting messages in the Processing console, the Processing status bar warned me of a Null Pointer Exception and did not finish execution.

Both of these errors occurred on the led.setColor(255,0,0);

This is the error I got when the BlinkStick was plugged in:

java.lang.NullPointerException
	at blinkstick.BlinkStick.setColor(Unknown Source)
	at blinkstick.BlinkStick.setColor(Unknown Source)
	at sketch_160221a.setup(sketch_160221a.java:22)
	at processing.core.PApplet.handleDraw(PApplet.java:2377)
	at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1527)
	at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:316)
java.lang.NullPointerException
	at blinkstick.BlinkStick.setColor(Unknown Source)
	at blinkstick.BlinkStick.setColor(Unknown Source)
	at sketch_160221a.setup(sketch_160221a.java:24)
	at processing.core.PApplet.handleDraw(PApplet.java:2377)
	at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1527)
	at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:316)
java.lang.NullPointerException
	at blinkstick.BlinkStick.setColor(Unknown Source)
	at blinkstick.BlinkStick.setColor(Unknown Source)
	at sketch_160221a.setup(sketch_160221a.java:26)
	at processing.core.PApplet.handleDraw(PApplet.java:2377)
	at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1527)
	at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:316)
java.lang.NullPointerException
	at blinkstick.BlinkStick.setColor(Unknown Source)
	at blinkstick.BlinkStick.setColor(Unknown Source)
	at sketch_160221a.setup(sketch_160221a.java:28)
	at processing.core.PApplet.handleDraw(PApplet.java:2377)
	at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1527)
	at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:316)

Thanks,
Eric

Hey Eric,

it looks like that another instance is also using your device. Please keep sure that no BlinkStick Client is running in the background or any other programm using BlinkStick. If you cannot be sure, switch off the “AutoStart” function in the BlinkStick client and restart your PC. Then try again your processing program.

Thank you p0ke, closing the Client App worked!

However, when I tried running the ProIndexedColor example again, I got the following error:

java.io.IOException: A device attached to the system is not functioning.
	at com.codeminders.hidapi.HIDDevice.sendFeatureReport(Native Method)
	at blinkstick.BlinkStick.setMode(Unknown Source)
	at blinkstick.BlinkStick.setMode(Unknown Source)
	at ProIndexedColors.setup(ProIndexedColors.java:37)
	at processing.core.PApplet.handleDraw(PApplet.java:2377)
	at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1527)
	at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:316)

Any ideas?

Thanks,
Eric

Hmmm… seems the signals are sent too fast to the device.

Please change the example code as follows:

import blinkstick.*;

void setup() {
  BlinkStick device = BlinkStick.findFirst();
  
  if (device == null)
  {
    println("Not found...");  
  } 
  else
  {
    //You need to set the mode only once
    device.setMode(2);
    delay(100);

    device.setIndexedColor(0, 0, color(255, 0, 0));
    delay(20);
    device.setIndexedColor(0, 1, color(0, 255, 0));
    delay(20);
    device.setIndexedColor(0, 2, color(0, 0, 255));
  }

  noLoop();
}

Same error :confused:
I even tried increasing the 20 mSec delays to 100 mSec, but it had no effect. The error appears to be caused by the device.setMode(2);

Thanks,
Eric

I think the problems are in the library directly. After all those tries the device must already be in mode 2 so you can uncomment the setmode line.
Keep the delays in front of every setcolor and commenting the setmode should be a solution for now.

@eric you can delete the code part that sets the mode. It is not necessary as long as BlinkStick is already set with that mode at least once.

@arvydas thanks!

For the sake of making my program “bullet-proof,” I actually added an if statement in setup() to check if the mode is already set to 2 (or whatever that particular program needs it to be) and sets it if need be (see below). This way I can switch between multiple uses for the BlinkStick without having to worry about the mode.

void setup() {
  blinky = BlinkStick.findFirst();
  if (blinky == null) {
    println ("Device not found...");
  } else {
    if (blinky.getMode() != 2) {
     blinky.setMode(2);
     delay(100);
    }
  }
}

Thanks to you and @p0ke for your help!
Eric

Plug in the AC adapter.
Point to the right hand corner of the screen to bring up the ‘Charms Bar’.
Click ‘Settings’.
Click the shutdown button, hold down and click ‘Restart’ from the options provided.
The system restarts, login and click ‘Troubleshoot’.
Click the ‘Dell Backup and Recovery’ icon.
The system restarts and comes back up, click ‘Next’ on ‘Dell Backup and Recovery’ screen.
The system would be checked to see if the smart repair option can fix the issue, click ‘Next’ once this is done.
You will be prompted to select the backup to be used, click the factory image option or select .from one of the backups. Click ‘Next’.
You will be prompted to back up your files, select ‘No, Erase my files’.
The system goes ahead and completes the restore of the operating system. Click ‘Restart’ when prompted.
Follow the on-screen instructions to setup the system with windows.
If this would not solve your errors then check Dell Inspiron 1545 Manual for more advanced fixes.