   updateThrottle();
   updatePins();
   checkSerialInput();
+  updateLeds();
   delay(200);
 }
+


void checkSerialInput() {
  uint8_t c;
  uint8_t ledPin=0,val=0,id=0;
  // format: "^LG1=0$" turn off green led 1 (RCS), "^LR2=1$" turn off red led 2 (SCS)
  if (Serial.available()>0) {
  if (Serial.find("L")) {

const int throttlePin = A0;  // P0

const uint8_t nPins = 7; // długość tabel poniżej
const uint8_t switchPins[] = {4,  5, 8, 12, 0, 0,  0};	// Dx: stage, RCS, SAS, gear switch, overheat, lowpower, lowfuel
const uint8_t onPins[] =     {0, 13, 9,  0, 0, 0,  0};	// Gx: stage, RCS, SAS, overheat, lowpower, lowfuel ON (green)
const uint8_t offPins[] =    {0,  0, 0,  0, 6, 7, 10};	// Rx: stage, RCS, SAS, overheat, lowpower, lowfuel OFF (red)
uint8_t lastPinState[] = {HIGH, HIGH, HIGH, HIGH, HIGH, HIGH, HIGH};
uint8_t lastLedState[] =  {0, 0, 0, 0, 0, 0, 0};	// bits: 0=GxON, 1=RxON, 2=GxBLINK, 3=RxBLINK

// blinker control
unsigned long lastBlink = 0;
const unsigned long blinkInterval = 500;

// throttle control
int lastThrottleValue = 0;
