Servo control

I am writing some code for the hexy that will need a lot of code space. To save memory, I am trying to use minimal commands for moving the servos. When I tried the following code on an arduino mega it works fine (the pin referenced had been set to OUTPUT), but when I load it onto the hexy I get no response. Am I missing something? Is there something different about the hexy board as opposed to a stock arduino? Can I get around it. With this routine I am already almost 3k less code space than if I load in the Servomotor library and I anticipate needing every byte. For example to center servo on pin 5 it would be moveservo(5,1500);

void moveservo(byte pin,int duration){ byte i; for(i=0;i<25;i++){ digitalWrite(pin,HIGH); delayMicroseconds(duration); digitalWrite(pin,LOW); delay(10); } }
Thanks for the help

Hexy’s board is based off the Arduino Leo, that may have something to do with it?

Its because servos are done over shift registers, in order to have enough outputs. We highly recommend using the library that’s already included with the default servotor32 firmware/

I was afraid it was something like that. Is there any code that I can safely remove from the library (I only need the motion controls and maybe the sonar) I am just worried that I will run out of space.
WM