Serial 1 - Intro from Jeff Feddersen on Vimeo.
PROCESSING CODE STEP 1.
FIRST - check console and its output from the Serial.list function -see code excerpt from processing sketch
below,you will then need to update the Serial port in your Processing code;
https://processing.org/reference/libraries/serial/Serial_list_.html
HERE:
PROCESSING CODE (check serial port)
//processing EtchaSketch
// Etch-a-Sketch
// based on a sketch by Trevor Shannon
import processing.serial.*;
Serial myPort;
int lastX = -1;
int lastY = -1;
int x;
int y;
String nextXY;
void setup() {
size(512, 512);
background(255);
println(Serial.list());
myPort = new Serial(this, Serial.list()[3], 9600);
myPort.bufferUntil('\n');
}
void draw() {
String[] parts = splitTokens(nextXY);
if (parts.length >= 2) {
x = int(parts[0])/2;
y = int(parts[1])/2;
if (lastX >= 0 && lastY >= 0) {
line(x, y, lastX, lastY);
}
lastX = x;
lastY = y;
}
}
void mouseClicked() {
background(255);
}
void serialEvent(Serial p) {
nextXY = p.readString();
}
PC :
myPort = new Serial(this, Serial.list()[1], 9600);
MAC
ie you might be using a different port .ie - then you will need to update the number
PC :
myPort = new Serial(this, Serial.list()[1], 9600);
MAC:
myPort = new Serial(this, Serial.list()[3], 9600);
FIRST TEST IN PROCESSING with simple serial read