Getting compile error with ServoTimer2

Hi, one question. My arduino IDE is up to date.

I have an old project using ServoTimer2 and VirtualWire librairies and everything is working very well. I’m still doing some modification in this project and everything is compiling good.

I’m beginning another project using a servo.

Both of my arduino code’s page are open at the same time and when I click the compile button in my old project it compile good and in my new project I got an error coming from the ServoTimer2.h (not from my code)

Got 2 error from the ServoTimer2.h. It tells me: Boolean attached() and Boolean attached(int) does not return Boolean type or are not made to return Boolean type (sorry I’m not home right now so I don’t have the right message).

My code is basic for now and canno’t be the problem

#include <ServoTimer2.h>

int pinServo = 7;

ServoTimer2 myServo;

void setup(){
  myServo.attach(pinServo);
  myServo.write(90);
}

If the error is in the ServoTimer2.h (according to the compiler) why is my other project using it is working good ?

any idea?

sorry I'm not home right now so I don't have the right message).

Sorry, I'm not at home now, so come on back when you have the EXACT error message AND a link to where you got the ServoTimer2 library.

Really sorry, I didn't think about that.

I look back at the error message and I understand it (im french so I misread the message). I found my problem, but maybe just told me if it is ok or can cause other problem later.

My first project was made with the last IDE release. When I updated and compiled my project I got a message telling there was a double "typedef" for the boolean in the VirtualWire (include the arduino.h) and ServoTimer2. Before there was no compiling problem but now yes. Forum user told me to simply comment the line of the typedef in the servotimer2. Since then everything compile good.

But My newer project didn't have the VirutalWire so there is no double typedef for boolean (arduino.h)and this was my error message (error: 'boolean' does not name a type).

Step 1: I uncomment the line of the typedef but still got an error (C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:117:14: error: conflicting declaration 'typedef bool boolean'). I don't understand, i have nothing that include the arduino.h

Step 2: I included the arduino.h librairie in my new project and now there is no error.

Is it ok to include the arduino.h libraire simply for this typedef ?

I don't understand, i have nothing that include the arduino.h

Enable verbose mode for compiling. Notice that the ino file is converted to a cpp file, for compiling. Look at the cpp file. Notice how it differs from the ino file. You DO include Arduino.h (or, rather, the IDE does it on your behalf).

Step 2: I included the arduino.h librairie in my new project and now there is no error.

It does not make sense that the header file would generate an error when not included and not generate one when included.

I don't understand me neither.

Thank you.

wico2002:
Hi, one question. My arduino IDE is up to date.

I suspect that is the problem.

Try it with IDE 1.5.6 You can easily have several versions on your PC. They are just Java programs.

The “kind” Arduino folks don’t expend effort on backwards compatibility.

…R