         lastPos = servo_start;
       }
     }
-    //write last pos to eprom
-   //variables start with number 1  
+    /* 
+     * write last pos to eprom
+     * variables start with number 1        
+     */
     cbus.setInternalNodeVariable(servoidx+1,lastPos);
 
     servos[servoidx].write(lastPos,SPEED);
-    //servos already attached
+    /* servos already attached */
     //if (!attach_servo){
-	servos[servoidx].attach(servopins[servoidx]);
+	  servos[servoidx].attach(servopins[servoidx]);
     //}
     servos[servoidx].write(lastPos,SPEED);
    
   
 }
 
-//create the objects for each servo
+/* create the objects for each servo */
 void setupServos(){
   
   for (uint8_t i=0;i<NUM_SERVOS;i++){     

#include <EEPROM.h> //required by the library
#include <VarSpeedServo.h>

//uncomment this line to see debug messages
//#define DEBUGNODE

//Module definitions
#define NUM_SERVOS 8      //number of servos
//first 2 are to indicate which servo is on. 2 bytes to indicate to togle. 2 for start and end angle
#define VAR_PER_SERVO 6  //variables per servo
#define SPEED 50        //servo speed
#define SERVO_START 15        //servo start angle.start at 15 to avoid jitter
#define SERVO_END 180        //servo end angle


//CBUS definitions
#define GREEN_LED 8                  //merg green led port
#define YELLOW_LED 7                 //merg yellow led port
#define PUSH_BUTTON 9                //std merg push button

//Node definition
//number o node variables
#define NODE_VARS 2                  
//var1 = Servo speed
//var2 = flags
//flag1 (2 first bits) action to take on starting. see setupServos
//flag2 (bit 3), indicate to maintain the servo attached after moving. default is 0 = detached
#define SERVO_SPEED_VAR  1
#define SERVO_FLAGS_VAR  2 

#define NODE_EVENTS 30              //max number of events
#define EVENTS_VARS VAR_PER_SERVO   //number of variables per event
#define DEVICE_NUMBERS NUM_SERVOS   //number of device numbers. each servo can be a device
//the indexes start at 1 not at 0
#define ACTIVE_SERVO_VAR 1          //2 bytes for that
#define TOGLE_SERVO_VAR  3          //2 bytes for that
#define START_ANGLE_VAR  5          //var index for the start angle
#define END_ANGLE_VAR    6          //var index for the end angle


//create the merg object
MergCBUS cbus=MergCBUS(NODE_VARS,NODE_EVENTS,EVENTS_VARS,DEVICE_NUMBERS);

//servo controler
VarSpeedServo servos[NUM_SERVOS];

//pins where the servos are attached
//pins 9,10 and 15 don't work for many servos. servo library limitation
byte servopins[]={1,2,3,4,5,6,7,8};//,19,20,21,22,23,24,25,26,27,28,29,30};
byte active_servo[2]; //store the active servo event var
byte togle_servo[2]; //store the togle servo event var
boolean attach_servo = false;

     return false;
  }
}
/* get the events vars for activate servos and to togle the servos:invert behaviour on on/off events */
void getServosArray(Message *msg,MergCBUS *mcbus){
  active_servo[0]=mcbus->getEventVar(msg,ACTIVE_SERVO_VAR);
  active_servo[1]=mcbus->getEventVar(msg,ACTIVE_SERVO_VAR + 1);
