Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.serial.*;
- Serial port;
- void setup() {
- size(500,300);
- port = new Serial(this , Serial.list()[0], 9600);
- }
- void draw() {
- text("X Y mouse",250,50);
- if (port.available() > 0) {
- port.write(str(mouseX)+' '+str(mouseY));
- }
- }
- int x = 0;
- void setup() {
- Serial.begin(9600);
- }
- void loop() {
- if (Serial.available() > 0) {
- x = Serial.read();
- //Serial.print("I received: ");
- Serial.println(x);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement