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