diff --git a/hoverbrettvisualizer/hoverbrettvisualizer.pde b/hoverbrettvisualizer/hoverbrettvisualizer.pde index 8c4ac86..6ddad64 100644 --- a/hoverbrettvisualizer/hoverbrettvisualizer.pde +++ b/hoverbrettvisualizer/hoverbrettvisualizer.pde @@ -14,20 +14,22 @@ long lastDelay=0; void setup() { size(640, 360); + frameRate(100); printArray(Serial.list()); - serialport = new Serial(this, Serial.list()[2], 9600); + serialport = new Serial(this, Serial.list()[2], 115200); - //vis = new BarV(150,150,10,100,0,100); + visVoltage = new BarV(50,150,10,100,10*3.3,12*4.2); + visVoltage.setcmain(color(100,100,100)); //vis = new BarH(150,150,100,10,0,100); - visVoltage = new Tacho(150,150,100,0,100); + //visVoltage = new Tacho(150,150,100,0,100); //vis = new Direction(150,150,100,0,100,0,1); visVoltage.setShowMinMax(true); visVoltage.setTitle("Voltage [V]"); - visCurrent= new Tacho(150+250,150,100,0,100); + visCurrent= new Tacho(150+250,150,100,0,50); visCurrent.setShowMinMax(true); visCurrent.setTitle("Current [A]"); @@ -36,7 +38,6 @@ void setup() { void draw() { receive(); - background(255); visVoltage.setValue(voltage); visCurrent.setValue(current); @@ -59,15 +60,17 @@ void draw() { public void receive() { + boolean received=false; byte[] inBuffer = new byte[8]; while(serialport.available()>0) { - //inBuffer = serialport.readBytes(); + received=true; + inBuffer = serialport.readBytes(); serialport.readBytes(inBuffer); - //if (inBuffer != null) { + if (inBuffer != null) { voltage = extract_float(inBuffer,0); current = extract_float(inBuffer,4); - //} + } } if (received){