   kHeading = 11, // CMDID for data updates from SPAD.neXt
 };
 
+int lastLedState = 999;
+bool isReady = false;
+
 void attachCommandCallbacks()
 {
   // Attach callback methods

// Called when a received command has no attached function
void onUnknownCommand()
{
  messenger.sendCmdStart(kDebug);
  messenger.sendCmdArg("UNKNOWN COMMAND");
//  messenger.sendCmdArg(messenger.lastCommandId);
//  messenger.sendCmdArg(messenger.commandBuffer);
  messenger.sendCmdEnd();
}

// Callback function to respond to indentify request. This is part of the

{
  // Process incoming serial data, and perform callbacks
  messenger.feedinSerialData();

  // Update Led-Data on SPAD.neXt
  int ledVal = digitalRead(ledPin);
  if ((ledVal != lastLedState) && isReady)
  {
     lastLedState = ledVal;
     messenger.sendCmd(kLed,ledVal);
  }
 
}
