     case 6 :
         //read analog value
         pin = readData();
-        sum = 0;
-        for(int i = 0; i < num; i++) {
-          sum += analogRead(pin);
-          //vcc.addValue(readVcc()); //continue averaging vcc during this process
+        if (pin == 0) {
+          Serial.println(a0.getAverage()); break;
         }
-        avg = sum/num;
-        Serial.println(avg); break;
+        else if (pin == 1) {
+          Serial.println(a1.getAverage()); break;
+        }       
+        else {
+          Serial.println(analogRead(pin)); break;
+        }
+        break;
     case 7 :
       //set DAC value
       writeDAC(); break;

int value = 0;
int cmd = 0;

//variables for averaging
int num = 30;
float sum = 0, avg;

RunningAverage vcc(30);

void setup()
{

  //analogReference(INTERNAL2V56)

  vcc.clear();
  a0.clear();
  a1.clear();

  delay(300);
}

void loop(){
  
  switch (readData()) {
    case 1 :
