From 0a3206e9b6912eb519996e9812bc6a4d48426796 Mon Sep 17 00:00:00 2001 From: aster94 Date: Mon, 12 Dec 2016 01:36:00 +0100 Subject: [PATCH] Update processing_LA.pde --- processing_LA.pde | 116 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 82 insertions(+), 34 deletions(-) diff --git a/processing_LA.pde b/processing_LA.pde index e4d19f8..631108a 100644 --- a/processing_LA.pde +++ b/processing_LA.pde @@ -13,8 +13,7 @@ int grey = 150; // shift, reducer and millisecond view float reducer = 1.0; boolean milliseconds = false; -boolean isMilliseconds= false; -int xShift; +float xShift; // start point in the processing window @@ -22,7 +21,7 @@ int xEdge = 60; int yEdge = 30; int xEnd; float[] xPos = {0, 0, 0, 0, 0, 0}; -int yBottom = 390; +int yBottom; int yDiff; int yPos = yEdge; int ySave = yEdge; @@ -41,8 +40,8 @@ boolean dataComplete = false; boolean [][] state; boolean [] isLow = new boolean[6]; float[] usTime; -int[] changed; float[] xTime; +int[] pinChanged; //buttons and others @@ -56,30 +55,45 @@ int buttonH = 20; int smallButtonW = 50; int bigButtonW = 100; int graphBoxH; +int textBoxH; int immage = 1; int corner = 10; +// bar scroll +int handleFill = grey; +float handleX; +float handleY; +float handleW = 20; +float handleH = 15; +boolean isDraggable = false; + + void setup () { p = new Serial(this, "com3", 9600); p.bufferUntil('\n'); - size(1000, 450); + size(1000, 460); background(black); smooth(4); - graphBoxH = height -40; - buttonY = height -30; + graphBoxH = height -50; + textBoxH = height - 35; + yBottom = graphBoxH-20; + buttonY = textBoxH +8; + handleX = xEdge; + handleY = graphBoxH; } void cleanGraph() { noStroke(); //no borders fill(black); - rect(xEdge, 0, width, graphBoxH); //cancel the graph - stroke(green); //line color + rect(xEdge, 0, width, graphBoxH); //cancel the graph + stroke(green); //green lines Arrays.fill(xPos, 0); //reset start point of the graph + textCovered = false; } @@ -87,14 +101,14 @@ void draw () { if (dataComplete==true) { cleanGraph(); - pushMatrix(); //move the coordinate reference + pushMatrix(); //move the coordinate reference translate(xEdge, 0); for (int i=0; iwidth-handleW) handleX = width-handleW; + + getData(); + xShift = -map(handleX, xEdge, width-handleW, 0, xEnd-900); + } + +} + + +void mousePressed() { + if (mouseX>handleX && mouseXhandleY && mouseYbuttonY && mouseY button5X && mouseX buttonY && mouseY button4X && mouseX yBottom-15 && mouseY button1X && mouseX handleX && mouseXhandleY && mouseY