-// *** SendandReceiveArguments ***
+// *** SentandReceive ***
 
-// This example expands the previous SendandReceive example. The Arduino will now receive multiple 
-// and sent multiple float values. 
+// This example expands the previous Receive example. The Arduino will now send back a status.
 // It adds a demonstration of how to:
-// - Return multiple types status; It can return an Acknowlegde and Error command
-// - Receive multiple parameters,
-// - Send multiple parameters
-// - Call a function periodically
+// - Handle received commands that do not have a function attached
+// - Send a command with a parameter to the PC
 
 #include <CmdMessenger.h>  // CmdMessenger
 
 // Blinking led variables 
-unsigned long previousToggleLed = 0;   // Last time the led was toggled
 bool ledState                   = 0;   // Current state of Led
 const int kBlinkLed             = 13;  // Pin of internal Led
 

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

  // Toggle LED periodically. If the LED does not toggle every 2000 ms, 
  // this means that cmdMessenger are taking a longer time than this  
  if (hasExpired(previousToggleLed,2000)) // Toggle every 2 secs
  {
    toggleLed();  
  } 
}

// Toggle led state 
void toggleLed()
{  
  ledState = !ledState;
  digitalWrite(kBlinkLed, ledState?HIGH:LOW);
}  

// In order to receive, attach a callback function to these events
enum
{
  kSetLed              , // Command to request led to be set in specific state
  kStatus              , // Command to report status
};

// Callbacks define on which received commands we take action
void attachCommandCallbacks()
{
  // Attach callback methods
  cmdMessenger.attach(OnUnknownCommand);
  cmdMessenger.attach(kSetLed, OnSetLed);
}

// Called when a received command has no attached function
void OnUnknownCommand()
{
  cmdMessenger.sendCmd(kStatus,"Command without attached callback");
}

// Callback function that sets led on or off
void OnSetLed()
{
  // Read led state argument, interpret string as boolean
  ledState = cmdMessenger.readBoolArg();
  // Set led
  digitalWrite(kBlinkLed, ledState?HIGH:LOW);
  // Send back status that describes the led state
  cmdMessenger.sendCmd(kStatus,(int)ledState);
}

// Setup function
void setup() 
{
  // Listen on serial connection for messages from the PC
  Serial.begin(115200); 

  // Adds newline to every command
