   // pin13 LED
   pinMode(13, OUTPUT);
 
-  // Make input & enable pull-up resistors on switch pins
+  // Make input & enable pull-up resistors on button pins
   for (i=0; i< NUMBUTTONS; i++) {
     pinMode(buttons[i], INPUT);
     digitalWrite(buttons[i], HIGH);

  static long lasttime;
  byte index;
  if (millis() < lasttime) {
     lasttime = millis(); // we wrapped around, lets just try again
  }

  if ((lasttime + DEBOUNCE) > millis()) {
    return; // not enough time has passed to debounce
  }
  // ok we have waited DEBOUNCE milliseconds, lets reset the timer
  lasttime = millis();

  for (index = 0; index < NUMBUTTONS; index++) {
    /*justpressed[index] = 0;       // when we start, we clear out the "just" indicators
    justreleased[index] = 0;*/

    currentstate[index] = digitalRead(buttons[index]);   // read the button
    if (currentstate[index] == previousstate[index]) {
      pressed[index] = !currentstate[index];  // remember, digital HIGH means NOT pressed
    }
    //Serial.println(pressed[index], DEC);
    previousstate[index] = currentstate[index];   // keep a running tally of the buttons
  }
}


#define DEBOUNCE 10  // button debouncer 5+ ms

byte buttons[] = {3, 4, 5}; // D2-D12
String buttonNames[] = {"pb1", "pb2", "pb3"};
#define NUMBUTTONS sizeof(buttons)

byte potmeters[] = {18}; // A0-14, A5-19 6

String potmeterNames[] = {"pot1"};
#define NUMPOTMETERS sizeof(potmeters)

// pressed buttons
byte pressed[NUMBUTTONS];

void setup() {
