Guest User

Untitled

a guest
May 26th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.75 KB | None | 0 0
  1. import controlP5.*;
  2. ControlP5 cp5;
  3. import processing.serial.*;
  4. Serial myPort;
  5. void setup()
  6. {
  7.   size(800,800);
  8.   cp5=new ControlP5(this);
  9.   cp5.addButton("a").setValue(0).setPosition(100,100).setSize(200,200);
  10.   cp5.addButton("b").setValue(0).setPosition(500,100).setSize(200,200);
  11.   cp5.addButton("c").setValue(0).setPosition(100,400).setSize(200,200);
  12.   cp5.addButton("d").setValue(0).setPosition(500,400).setSize(200,200);
  13.  myPort=new Serial(this, "COM18", 9600);
  14. }
  15. void draw()
  16. {
  17.   background(0);
  18. }
  19. public void a()
  20. {
  21.   println("0");
  22.   myPort.write("0");
  23. }
  24.  
  25. public void b()
  26. {
  27.   println("90");
  28.   myPort.write("1");
  29. }
  30. public void c()
  31. {
  32.   println("2");
  33.   myPort.write("2");
  34. }
  35. public void d()
  36. {
  37.   println("90");
  38.   myPort.write("3");
  39. }
Add Comment
Please, Sign In to add comment