programação criativa, SESC Santana, São Paulo, de 20/04/17 a 13/07/17

Participantes:

Arthur Medeiros Pescuma

Lilia Chou

Linda Chou

Tiago Pessoa

Vinícius Juliane Pereira

Fernanda Fernandes

Mary Morita

Rodrigo Bruno

Juliana Harrison Henno

Juliana apresentando o código Sensor ultrassônico:

importprocessing.serial.*;SerialmyPort;// The serial portintxPos=1;//We declare a variable of integers, horizontal position of the graphfloatinByte=0;//We declare a variable with decimal numbersvoidsetup(){size(600,300);myPort=newSerial(this,Serial.list()[2],9600);// println(Serial.list());myPort.bufferUntil('\n');// Establishes a specific byte to buffer before calling up serialEventbackground(150);}voiddraw(){stroke(255);// draw the line, stroke is the colour and line:line(xPos,height,xPos,height-inByte);if(xPos>=width){// at the edge of the screen, go back to the beginning:xPos=0;background(150);}else{xPos++;// increment the horizontal position:}}voidserialEvent(SerialmyPort){StringinString=myPort.readStringUntil('\n');// get the ASCII string:if(inString!=null){inString=trim(inString);// trim off any whitespace:inByte=float(inString);// convert to an int and map to the screen height:println(inByte);inByte=map(inByte,0,30,0,height);}}