     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;

  //analogReference(INTERNAL2V56)

  vcc.clear();

  delay(300);
}

void loop(){

  vcc.addValue(readVcc());
  
  switch (readData()) {
    case 1 :

char readData() {
  Serial.println("w");
  while(1) {
    
    vcc.addValue(readVcc());
    a0.addValue(analogRead(0));
    a1.addValue(analogRead(1));
    
    if(Serial.available() > 0) {
      return Serial.parseInt();
    }
