Processing example on Ubuntu linux - can only run once, then need to replug usb

Following the instructions from http://blinkinlabs.com/blinkytape/docs/processing/ ... I've installed Processing and can run the sample code, but only once.

When I plug in the blinkytape, dmesg shows:

[417858.119088] usb 3-1: new full-speed USB device number 6 using xhci_hcd
[417858.169849] usb 3-1: New USB device found, idVendor=1d50, idProduct=605e
[417858.169861] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[417858.169866] usb 3-1: Product: BlinkyTape
[417858.169871] usb 3-1: Manufacturer: Blinkinlabs
[417858.172942] cdc_acm 3-1:1.0: This device cannot do calls on its own. It is not a modem.
[417858.172979] cdc_acm 3-1:1.0: ttyACM3: USB ACM device
[417858.193113] input: Blinkinlabs BlinkyTape as /devices/pci0000:00/0000:00:1c.6/0000:0f:00.0/usb3/3-1/3-1:1.2/input/input24
[417858.193452] hid-generic 0003:1D50:605E.000F: input,hidraw4: USB HID v1.01 Mouse [Blinkinlabs BlinkyTape ] on usb-0000:0f:00.0-1/input2

When I copy and paste the code starting "// The simplest possible way to talk to a BlinkyTape", I replaced:

if (p.startsWith("/dev/tty.usbmodem")) {

with:

if (p.startsWith("/dev/ttyACM3")) {

When I press "play" it works once, but if I make any changes to the code I need to unplug the blinky tape and plug it back in.

dmesg shows this:

[417198.189455] cdc_acm 3-1:1.1: acm_start_wb - usb_submit_urb(write bulk) failed: -19

I have no idea what that means, but it seems to be related :)


Comments

  • Hmm, that's a strange one...

    What version of Processing do you have? This might be an issue with the low-level serial code. We also recently made some changes to the "SerialSelector" code in many of the examples and it should now work on Linux.
  • Also, it should help if you were to use Arduino to load one of the new demo sketches like Colorswirl - we made some updates to the sketch loaded on production tapes, and it should be more stable. See this page for more: http://blinkinlabs.com/blinkytape/docs/arduino/
  • Thanks Threethan.

    Just looking at this again. Since I posted I've done a clean reinstall of linux and now I'm on Ubuntu 14.04. I no longer see the cdc_adm error message in dmesg but get the same behaviour - I need to replug the blinkytape for the example to work in processing.

    Processing is version 2.2.1.

    I have processing installed in ~/processing-2.1.1/

    That created a directory at ~/sketchbook and inside that I have libraries/controlP5 which was installed via the gui and libraries/BlinkyTape which I downloaded as per the instructions (the instructions only state where to put it on Mac and Windows so I assume this is correct.

    I needed to add my user to the dialout group to access /dev/ttyACM3 and it seems that for most of the demos I need to change the /dev/* string to match that.

    The examples in the BlinkyTape library seem okay - I don't need to replug.

    What would you recommend if I wanted to create a minimal starting point that I can start coding from?

    I'll have a look at arduino.


  • Hmm...interesting. I've noticed that in some of the Processing examples we don't explicitly close the serial connections in a stop() loop - on most architectures this doesn't seem to matter but I wonder if it might here?

    Give that a shot and let us know if it makes any difference. Thanks!
  • Actually it seems like that might be deprecated, but here's a good thread with a few ideas on how to achieve this: http://forum.processing.org/one/topic/run-code-on-exit.html

    TL:DR is try exit() or dispose() among a few other things.
  • Newer versions of processing should do the close automatically.
  • edited October 2014
    Hi Threeethan

    I've installed Arduino and followed the instructions on http://blinkinlabs.com/blinkytape/arduino/

    Have have the board set to Leonardo and got the serial post from the dmesg output.

    When I upload ColorSwirl the blinkytape goes dark.

    I get "Binary sketch size: 9,148 bytes (of a 28,672 byte maximum)"

    but no other output.

    HelloBlinky seems to work, as do all the other examples I tested.

    I've created some code with processing (not using a simple "virtual" blinkytape I created) and was hoping to have it converted to an arduino sketch for an event this weekend.

    The code is based on "the simplest blinkytape program" here: http://blinkinlabs.com/blinkytape/processing/ ... which I'm assuming does the same thing as ColorSwirl?

    Thanks again for your help!

    Edit: I'm playing around with the Button example which pretty much does what I want, so I'm happy now... thanks again!
  • Hey David - sorry for the slow response this time, but it sounds like you're OK now?

    I was going to suggest that you try the updated "production sketch" here: https://github.com/Blinkinlabs/BlinkyTape/tree/master/ProductionSketch

  • edited October 2014
    Not a problem, thanks Threeethan, will check it out.

    Edit: Flashed the production sketch, processing is working correctly now, I can modify code and run it without unplugging the blinkytape.
Sign In or Register to comment.