 
 int currentNote = 0;
 bool gate = false;
+String connectionData;
+String knobData;
 
 void loop() {
+  long timeCheck = millis();
   int i,j,k,m;
+  connectionData = "C";
   
   // supply 5V to each "write" demultiplexer in turn
   for(i=0;i<8;i++) {

  }
  
  //checkMidi();
  Serial.println(gate?"G1":"G0");
  Serial.print("N");
  Serial.print(currentNote);
  Serial.print("\n");
  Serial.println("DONE");
  digitalWrite(13, gate);
  delay(4000);
}

void checkMidi() {

              Serial.print("-");
              Serial.print(m*8 + k);
              Serial.print("\n");
              connectionData += String(i*8 + j) + String("-") + String(m*8 + k) + String(",");
            }
          }
        }

        // knob multiplexers are sharing selector pins with connection multiplexers
        // this means this is a good place to read the analogue values
        // currently not doing this every loop because it would be too slow(?)
        if(j==0) {
          for(m=0;m<2;m++) {
            knobData = String("A")+String(m*8+k)+String("-")+String(analogRead(m));
            Serial.println(knobData);
          }
        }
      }
