From 83850eb4fcd5573556179b5c88f9f7e38096690c Mon Sep 17 00:00:00 2001 From: aster94 Date: Thu, 29 Jun 2017 17:54:04 +0200 Subject: [PATCH] Update processing_LA.pde --- processing_LA.pde | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/processing_LA.pde b/processing_LA.pde index 0bb10af..93a1aef 100644 --- a/processing_LA.pde +++ b/processing_LA.pde @@ -8,10 +8,12 @@ Serial p; //uncomment the line where your arduino/STM32 is connected //String LA_port = "/dev/ttyACM0"; //linux DFU //String LA_port = "/dev/ttyUSB0"; //linux Serial -String LA_port = "COM9"; //windows, change the number with the real port where your arduino is connected +String LA_port = "COM10"; //windows + +final int baudrate = 115200; //change it to true if you are using a STM32 instead of arduino -boolean STM32 = false; +final boolean STM32 = false; /*------------------END SETUP-----------------*/ //////////////////////////////////////////////// @@ -86,7 +88,7 @@ boolean isDraggable = false; void setup () { //p = new Serial(this, Serial.list()[0], 115200); - p = new Serial(this, LA_port, 115200); + p = new Serial(this, LA_port, baudrate); p.bufferUntil('\n'); size(1000, 460); @@ -154,7 +156,13 @@ void draw () { } } - xEnd = int (xTime[samples-1]) +10; + + if (samples!=0) { + xEnd = int (xTime[samples-1]) +10; + } else { + xEnd = 0; + } + yPos = yEdge; for (int n = 0; n < 6; n++) { if (xPos[n]!=0) { //draw only the pin which are active @@ -188,16 +196,15 @@ void drawText() { int y=50; if (STM32) { - + for (byte i = 12; i<=15; i++) { line(x, y-20, xEdge, y-20); line(x, y+10, xEdge, y+10); text ("PB"+i, x, y); y+=60; } - } else { - + for (byte i = 8; i<=13; i++) { line(x, y-20, xEdge, y-20); line(x, y+10, xEdge, y+10); @@ -205,7 +212,7 @@ void drawText() { y+=60; } } - + // draw buttons fill(grey); @@ -265,6 +272,7 @@ void mouseClicked() { if (mouseY>buttonY && mouseY button2X && mouseX