 #include "Cosa/Pins.h"
 #include "Cosa/Watchdog.h"
 
-// The state machine: Blink RGB with six color states
+// The state machine: Blink RGB LED with six color states
 class BlinkRGB : public FSM {
+
 public:
-  // Timeout before going to next color state
-  static const uint16_t TIMEOUT = 128;
-
   // The output pins
   OutputPin redLedPin;
   OutputPin greenLedPin;
   OutputPin blueLedPin;
 
-  BlinkRGB(uint8_t redLedPinNr, uint8_t greenLedPinNr, uint8_t blueLedPinNr) :
+  // Timeout period
+  uint16_t timeout;
+  
+  // Construct the state machine for the RGB led sequencing
+  BlinkRGB(uint16_t ms = 512,
+	   uint8_t redLedPinNr = 5, 
+	   uint8_t greenLedPinNr = 6, 
+	   uint8_t blueLedPinNr= 7) :
     FSM(redState),
     redLedPin(redLedPinNr, 1),
     greenLedPin(greenLedPinNr),
-    blueLedPin(blueLedPinNr, 1)
+    blueLedPin(blueLedPinNr, 1),
+    timeout(ms)
   {}
 
   // State functions; red => yellow => green => cyan => blue => meganta

  {
    BlinkRGB* rgb = (BlinkRGB*) fsm;
    rgb->redLedPin.toggle();
    fsm->set_timer(TIMEOUT);
    fsm->set_state(cyanState);
    return (1);
  }

  {
    BlinkRGB* rgb = (BlinkRGB*) fsm;
    rgb->greenLedPin.toggle();
    fsm->set_timer(rgb->timeout);
    fsm->set_state(magentaState);
    return (1);
  }
