Guest User

7 segment with processing

a guest
Apr 11th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 KB | None | 0 0
  1. import controlP5.*;
  2. ControlP5 cp5;
  3. import processing.serial.*;
  4. Serial myPort;
  5. void setup()
  6. {
  7.   size(800,700);
  8.   cp5=new ControlP5(this);
  9.   cp5.addButton("a").setValue(0).setPosition(350,100).setSize(100,10);
  10.   cp5.addButton("b").setValue(0).setPosition(340,100).setSize(10,100);
  11.   cp5.addButton("c").setValue(0).setPosition(450,100).setSize(10,100);
  12.   cp5.addButton("d").setValue(0).setPosition(350,200).setSize(100,10);
  13.   cp5.addButton("e").setValue(0).setPosition(340,200).setSize(10,100);
  14.   cp5.addButton("f").setValue(0).setPosition(450,200).setSize(10,100);
  15.   cp5.addButton("g").setValue(0).setPosition(340,300).setSize(120,10);
  16.   cp5.addButton("dp").setValue(0).setPosition(470,300).setSize(10,10);
  17.   myPort=new Serial(this, "COM18", 9600);
  18. }
  19. void draw()
  20. {
  21.   background(0);
  22. }
  23. public void a()
  24. {
  25.   println("a");
  26.   myPort.write("a");
  27. }
  28.  
  29. public void b()
  30. {
  31.   println("b");
  32.   myPort.write("b");
  33. }
  34. public void c()
  35. {
  36.   println("c");
  37.   myPort.write("c");
  38. }
  39. public void d()
  40. {
  41.   println("d");
  42.   myPort.write("d");
  43. }
  44. public void e()
  45. {
  46.   println("e");
  47.   myPort.write("e");
  48. }
  49.  
  50. public void f()
  51. {
  52.   println("f");
  53.   myPort.write("f");
  54. }
  55. public void g()
  56. {
  57.   println("g");
  58.   myPort.write("g");
  59. }
  60. public void dp()
  61. {
  62.   println("dp");
  63.   myPort.write("h");
  64. }
Add Comment
Please, Sign In to add comment