// visualising FingerTip sensor // temp sensor at A0 // 5 touch sensors at A1-A5 // Dincer Hepguler 2017 import processing.serial.*; Serial myPort; float Val0; float Val1; float Val2; float Val3; float Val4; float Val5; float Vsum; void setup() { size(640,480); println(Serial.list()); myPort = new Serial(this, Serial.list()[1], 57600); // read bytes into a buffer until you get a linefeed (ASCII 10): myPort.bufferUntil('\n'); background(150,150,200); fill(200); rect(250,50,130,50); textSize(28); fill(150,50,50); text("TEMP",280,45); text("TOUCH",270,255); text("AMOUNT OF FORCE",160,340); fill(200); rect(260,110,30,50); rect(260,170,30,50); rect(300,110,30,110); rect(340,110,30,50); rect(340,170,30,50); rect(100,350,400,20); } void draw() { //clear the rectangles fill(200); rect(250,50,130,50); rect(260,110,30,50); rect(260,170,30,50); rect(300,110,30,110); rect(340,110,30,50); rect(340,170,30,50); rect(100,350,400,20); //type in the temperature value textSize(28); fill(50); text(Val0,255,80); //fill with shades of gray according to touch values fill(Val1);rect(260,110,30,50); fill(Val2);rect(260,170,30,50); fill(Val3);rect(300,110,30,110); fill(Val4);rect(340,110,30,50); fill(Val5);rect(340,170,30,50); rect(100,350,Vsum/2,20); } // serialEvent method is run automatically // whenever the buffer receives a linefeed byte void serialEvent(Serial myPort) { // read the serial buffer: String myString = myPort.readStringUntil('\n'); // if we get any bytes other than the linefeed: if (myString != null) { // remove the linefeed myString = trim(myString); // split the string at commas and convert the sections into values float mysensors[] = float(split(myString, ',')); int count = mysensors.length; for (int i=0; i