error with megaservo library

Hi guys,

maybe just a dumb issue, I need to drive 16 servos with a single arduino, I've bought a Mega 2560 board in order to get rid all the problem given by elettronics such extra chips and pwm.

I'm trying the Megaservo library with the example sketch but when I try to compile it gives me the following error:

"C:\Users\myName\Desktop\arduino\libraries\MegaServo\MegaServo.cpp:56:23: error: WProgram.h: No such file or directory
C:\Users\myName\Desktop\arduino\libraries\MegaServo\MegaServo.cpp: In function 'void handle_interrupts(servoTimer_t, volatile uint16_t*, volatile uint16_t*)': etc........"

why can't it find the WProgram.h file? this sounds strange cos I've read that file is an arduino core library and the other sketch work perfectly...
is there anything wrong with the paths?

then I've tryed to use the simple Servo library but I've read that it support a max of 8 servos, I tryied with 16 servos, and it works but can't drive the first one. very strange....

this is the sketch I tryied, a very simple one just to test:

#include <Servo.h>


Servo ser1;
Servo ser2;
Servo ser3;
Servo ser4;
Servo ser5;
Servo ser6;
Servo ser7;
Servo ser8;
Servo ser9;
Servo ser10;
Servo ser11;
Servo ser12;
Servo ser13;
Servo ser14;
Servo ser15;
Servo ser16;

int pos = 0; // variable to store the servo position

void setup()
{
ser1.attach(22);
ser2.attach(23);
ser3.attach(24);
ser4.attach(25);
ser5.attach(26);
ser6.attach(27);
ser7.attach(28);
ser8.attach(29);
ser9.attach(30);
ser10.attach(31);
ser11.attach(32);
ser12.attach(33);
ser13.attach(34);
ser14.attach(35);
ser15.attach(36);
ser16.attach(37);
}


void loop()
{
ser1.write(0);
delay(200);
ser2.write(0);
delay(200);
ser3.write(0);
delay(200);
ser4.write(0);
delay(200);
ser5.write(0);
delay(200);
ser6.write(0);
delay(200);
ser7.write(0);
delay(200);
ser8.write(0);
delay(200);
ser9.write(0);
delay(200);
ser10.write(0);
delay(200);
ser11.write(0);
delay(200);
ser12.write(0);
delay(200);
ser13.write(0);
delay(200);
ser14.write(0);
delay(200);
ser15.write(0);
delay(200);
ser16.write(0);
delay(200);



delay(2000);


ser1.write(180);
delay(200);
ser2.write(180);
delay(200);
ser3.write(180);
delay(200);
ser4.write(180);
delay(200);
ser5.write(180);
delay(200);
ser6.write(180);
delay(200);
ser7.write(180);
delay(200);
ser8.write(180);
delay(200);
ser9.write(180);
delay(200);
ser10.write(180);
delay(200);
ser11.write(180);
delay(200);
ser12.write(180);
delay(200);
ser13.write(180);
delay(200);
ser14.write(180);
delay(200);
ser15.write(180);
delay(200);
ser16.write(180);

delay(2000);

}

thanks a lot to anyone can help me!!!!

J_derius

You need to read about Arduino.h AND you need to start using arrays.

sorry now with the simple Servo library works, maybe was just a bad connection.
anyway I wonder why it seems to support 16 servos altough since is written in the original example sketch it supports a maximum of 8 servos.

thanks anyway

j_derius

thanks a lot AWOL I'll do it

:slight_smile: