How to save ellipse color if mouse pressed via serial Port

edited June 2016 in Arduino

Hey, i want the ellipse that is being drawn to save its color on every position it was. i want to have the pen Function in Paint. here is my code and thanks for your help!!

` import processing.serial.*;

float x,y;

void setup() {


Serial arduino = new Serial(this, "COM3", 250000);



void draw()



void serialEvent(Serial p) {

String rawString = p.readStringUntil('\n');

if (rawString != null) {

rawString = rawString.trim();


String[] values = split(rawString,",");

int serialX = int(values[0]);

int serialY = int(values[1]);    

x = map(serialY,0,640,0,width);

y = map(serialX,0,480,0,height);

/* maybe something like

if (values[0]!=0)


fill ellipse(x,y,10,10); }


}catch(Exception e){

println("Error parsing string from Serial:");






Sign In or Register to comment.