Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import processing.serial.*;
- Serial myPort;
- String myText="";
- void setup(){
- size(300, 300);
- myPort = new Serial(this, "COM6", 9600);
- myPort.bufferUntil('n');
- }
- void serialEvent (Serial myPort){
- myText = myPort.readStringUntil('n');
- }
- void draw(){
- background(255,0,0);
- //ellipse(155, 100, 100, 100);
- fill(0,0,250);
- //background(0,255,0);
- text(myText, 120, 120);
- fill(250,250,250);
- myText="Vou de boas!";
- if(mousePressed && (mouseButton == LEFT)){
- myPort.write('1');
- myText="Para de apertar!";
- textSize(26);
- }
- if (mousePressed && (mouseButton == RIGHT)){
- myPort.write('0');
- myText="Melhor!";
- textSize(12);
- }
- //delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement