Go Down

Topic: servotimer2 problems (Read 1 time) previous topic - next topic

I installed within the libraries in a folder called ServoTimer2 the 3 files that make up the zip.
When I try to compile this simple code:

#include <ServoTimer2.h>

void setup(){}

void loop(){}


I get the following error.
/home/marcelo/arduino-1.0.3/libraries/ServoTimer2/ServoTimer2.cpp:5:26: error: WConstants.h: No existe el archivo o el directorio
/home/marcelo/arduino-1.0.3/libraries/ServoTimer2/ServoTimer2.cpp: In function 'void __vector_9()':
/home/marcelo/arduino-1.0.3/libraries/ServoTimer2/ServoTimer2.cpp:35: error: 'LOW' was not declared in this scope
/home/marcelo/arduino-1.0.3/libraries/ServoTimer2/ServoTimer2.cpp:35: error: 'digitalWrite' was not declared in this scope
/home/marcelo/arduino-1.0.3/libraries/ServoTimer2/ServoTimer2.cpp:42: error: 'HIGH' was not declared in this scope
/home/marcelo/arduino-1.0.3/libraries/ServoTimer2/ServoTimer2.cpp:42: error: 'digitalWrite' was not declared in this scope
/home/marcelo/arduino-1.0.3/libraries/ServoTimer2/ServoTimer2.cpp: In member function 'uint8_t ServoTimer2::attach(int)':
/home/marcelo/arduino-1.0.3/libraries/ServoTimer2/ServoTimer2.cpp:65: error: 'OUTPUT' was not declared in this scope
/home/marcelo/arduino-1.0.3/libraries/ServoTimer2/ServoTimer2.cpp:65: error: 'pinMode' was not declared in this scope


Thank you very much to who can guide me in the solution.

PS: Use this library to use the module VirtualWire, if they know of any better combination even better.

AWOL

Code: [Select]
WConstants.h
Substitute "Arduino.h"
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

roter45

I have the same problem with servotimer2 when i change Wconstant to Arduino.h I had this errors

In file included from C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/Arduino.h:192,
                 from C:\Archivos de programa\Arduino\libraries\ServoTimer2\ServoTimer2.cpp:5:
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/WString.h:116: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, const char*)' conflicts with
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/WString.h:115: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, const String&)' here
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/WString.h:117: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, char)' conflicts with
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/WString.h:116: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, const char*)' here
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/WString.h:118: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, unsigned char)' conflicts with
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/WString.h:117: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, char)' here
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/WString.h:119: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, int)' conflicts with
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/WString.h:118: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, unsigned char)' here
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/WString.h:120: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, unsigned int)' conflicts with
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/WString.h:119: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, int)' here
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/WString.h:121: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, long int)' conflicts with
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/WString.h:120: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, unsigned int)' here
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/WString.h:122: error: declaration of C function 'StringSumHelper& operator+(const StringSumHelper&, long unsigned int)' conflicts with
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/WString.h:121: error: previous declaration 'StringSumHelper& operator+(const StringSumHelper&, long int)' here
In file included from C:\Archivos de programa\Arduino\libraries\ServoTimer2\ServoTimer2.cpp:5:
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/Arduino.h:196: error: declaration of C function 'uint16_t makeWord(byte, byte)' conflicts with
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/Arduino.h:195: error: previous declaration 'uint16_t makeWord(uint16_t)' here
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/Arduino.h:206: error: declaration of C function 'long int random(long int)' conflicts with
c:/archivos de programa/arduino/hardware/tools/avr/lib/gcc/../../avr/include/stdlib.h:504: error: previous declaration 'long int random()' here
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/Arduino.h:207: error: declaration of C function 'long int random(long int, long int)' conflicts with
C:\Archivos de programa\Arduino\hardware\arduino\cores\arduino/Arduino.h:206: error: previous declaration 'long int random(long int)' here
Visit my blog and leave some comments
controlrobotics.rodrigomompo.com

roter45

Hi I just fix the error you have to change in servoTimer2.ccp this:
Code: [Select]
extern "C" {
  // AVR LibC Includes
#include <inttypes.h
#include <avr/interrupt.h>
#include <WConstants.h>
}

For this:
Code: [Select]
#include<Arduino.h>

If you donĀ“t change all you will have more errors
Visit my blog and leave some comments
controlrobotics.rodrigomompo.com

Go Up