       writeDAC(); break;
     case 8 :
       //read Vcc using 1.1 V on board reference
-      Serial.println(readVcc()); break;
+      Serial.println(vcc.getAverage()); break;
     case 99:
       //just dummy to cancel the current read, needed to prevent lock
       //when the PC side dropped the "w" that we sent
       break;
   }
+
+  vcc.addValue(readVcc());
+  
 }
 
 char readData() {

int value = 0;
int cmd = 0;

void setup()
{
  //initialise I2C communication as Master

// https://www.controleverything.com/content/Digital-Analog?sku=AD5667_I2CDAC#tabs-0-product_tabset-2

#include<Wire.h>
#include<RunningAverage.h>

#ifndef SERIAL_RATE
#define SERIAL_RATE         115200
