p5.js-editor icon indicating copy to clipboard operation
p5.js-editor copied to clipboard

serialport on p5 editor 0.5.8 and later

Open luisaph opened this issue 9 years ago • 1 comments

Hello! I just downloaded the 0.6 version for the editor, and the serial library doesn't seem to be working on it. The code below works on v0.5.7, but not on 0.6 (or 0.5.10, 0.5.8, or 0.5.9). Perhaps I am missing something? Thought I'd ask before digging deeper into it : )

var serial;
function setup() {
  serial = new p5.SerialPort();

  var portlist = serial.list();
  serial.on('list', gotList);
}

function gotList(thelist) {
  for (var i = 0; i < thelist.length; i++) {
    println(i + " " + thelist[i]);
  }
}

Thank you! cc: @vanevery

luisaph avatar Jul 14 '16 19:07 luisaph

Hi! A work around would be to install p5.serialserver via npm (after installing node) and running it on the command line:

Install it: sudo npm install -g p5.serialserver Run it: p5serial

Then your sketch should work (you might want to make sure you are using the latest version of the library).

Please do let me know how it goes, I don't have a serial device in front of me to test with.

vanevery avatar Jul 14 '16 21:07 vanevery