   updateLeds();
   delay(200);
 }
-

unsigned long lastBlink = 0;
const unsigned long blinkInterval = 500;

// analog control
const uint8_t nAPins = 2;
const uint8_t aPins[] = {A0, A1};	// pot: throttle, timewarp
const int lastAValue[] = {0, 0};
const int aValue[] = {0, 0};
const int aThreshold[] = {2, 2};

// serial port
#define SERIAL_SPEED 9600

                }
		lastLedState[id] = nval;
	}
}

// commands like ^A{id}={val}$
void handleSerialInputAnalogOut() {
    uint8_t val=0,id=0;
    id = Serial.parseInt();  // skip '='
    val = Serial.parseInt(); // skip newline
//    Serial.print(id); Serial.println(val);  // echo for ack
	if (id>=0 && id<=nAOutPins) {
		analogWrite(aOutPins[id], val);
	}
}

void checkSerialInput() {
  uint8_t c;
  if (Serial.available()>0) {
    c = Serial.read();
	if (c == 'L') {
	  handleSerialInputLed();
	}
	if (c == 'A') {
	  handleSerialInputAnalogOut();
	}
  }
}

