So I have a java program that picks up the mouses x and y coords on the display and I would like to send those to my arduino and then move my two servos to those locations (I have two servos ontop of each other, one for x and one for y).
The java (processing) code i have is below
void draw(){ //same as loop in arduino
background(52, 152, 219); // background color of window (r, g, b) or (0 to 255)
//lets give title to our window
fill(0, 255, 0); //text color (r, g, b)
textFont(font);
text("Ripple Effect Maker", 80, 30); // ("text", x coordinate, y coordinat)
ellipse(mouseX, mouseY, 33, 33);
int x = mouseX;
int y = mouseY;
port.write(x+":"+y);
println(x+":"+y);
//println("y="+y);
delay(100);
}
I don't have much arduino code because I can't seem to find a way to split the data into two seperate variables and then move the servos to their corresponding variables.
Thanks for the help!