-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Milestone
Description
When the editor console gets data from an external server too fast, its buffer fills up. And when this happens, the console locks the editor up entirely. This makes it useless for serial debugging, or any remote data that's faster than a few bytes every 1/30th of a second. By contrast, the regular Java Developer Console works pretty well for these.
To duplicate this:
- Install and run Shawn van Every's p5.serialserver
- Attach an Arduino running the basic AnalogReadSerial sketch (Arduino IDE, File->Examples-Basics->AnalogReadSerial)
- Run the sketch below:
var serial; // variable to hold an instance of the serialport library
var xPos = 10; // ellipse position
function setup() {
createCanvas(320, 240);
serial = new p5.SerialPort(); // make a new instance of the serialport library
serial.on('list', printList); // callback function for serialport list event
serial.on('open', portOpen); // callback for serialport open event
serial.on('error', portError); // callback for serialport error event
serial.on('data', serialEvent);// callback for new data coming in
serial.list(); // list the serial ports
serial.open("/dev/cu.usbmodem14211"); // open a port
}
function draw() {
background("#2307AF");
fill(255);
ellipse(xPos, width/2, 20, 20);
}
// get the list of ports:
function printList(portList) {
// portList is an array of serial port names
for (var i = 0; i < portList.length; i++) {
// Display the list the console:
println(i + " " + portList[i]);
}
}
function portOpen() {
println("port open");
}
function portError(error) {
println(error);
}
function serialEvent() {
var inString = serial.readLine();
if (inString !== "") {
xPos = Number(inString);
//println(sensorValue);
}
}
Metadata
Metadata
Assignees
Labels
No labels