Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import processing.serial.*;
  2. Serial port;
  3. void setup() {
  4. size(500,300);
  5. port = new Serial(this , Serial.list()[0], 9600);
  6. }
  7.  
  8. void draw() {
  9. text("X Y mouse",250,50);
  10. if (port.available() > 0) {
  11. port.write(str(mouseX)+' '+str(mouseY));
  12. }
  13. }
  14.  
  15. int x = 0;
  16. void setup() {
  17. Serial.begin(9600);
  18. }
  19.  
  20. void loop() {
  21. if (Serial.available() > 0) {
  22. x = Serial.read();
  23. //Serial.print("I received: ");
  24. Serial.println(x);
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement