 
 /* Skip the first two pins, they are used by the USB port for communication. */
 #define PIN_OFFSET 2
-#define NUMBER_OF_PINS 14
-#define IO_MASK 0x3FFC
+#ifdef  ARDUINO_AVR_MEGA2560
+#define NUMBER_OF_PINS 54
+#else
+#define NUMBER_OF_PINS 13
+#endif
 
 static char buff[10];
 

 * name arduino_io
 * property /sequanto_automation_version sequanto_automation_version
 *
 * property /digital/(2..13)/direction digital_direction_get digital_direction_set
 * property /digital/(2..13)/pin digital_pin_get digital_pin_set
 * property /digital/(2..13)/counter digital_counter_get digital_counter_set
 * property /digital/(2..13)/counter_enabled digital_counter_enabled_get digital_counter_enabled_set
 * property /digital/(2..13)/count_on_high2low digital_counter_high2low_get digital_counter_high2low_set
 * property /digital/(2..13)/count_on_low2high digital_counter_low2high_get digital_counter_low2high_set
 *
 * # property /digital/(0..14)/mode digital_mode_get digital_mode_set
 * # property /digital/(0..14)/counter digital_counter_get digital_counter_set

        /* Set pull-up resistor. */
        digitalWrite ( _pin, HIGH );
        //sq_digital_pin_updated ( _pin, digital_pin_get(_pin) );
        io_direction[_pin] = SQ_FALSE;
        break;

    case DIGITAL_PIN_OUTPUT:
        pinMode ( _pin, OUTPUT );
        digitalWrite ( _pin, LOW );
        io_direction[_pin] = SQ_TRUE;
        break;
    }
}

int digital_counter_get ( int _pin )
