Go Down

Topic: Servo library error when compiling - SOLVED (Read 905 times) previous topic - next topic

zmatek

Jan 06, 2014, 09:46 pm Last Edit: Jan 07, 2014, 09:05 pm by zmatek Reason: 1
Hello all,

I just wanted to use servo library for my Due first time, but it does not work.
So I downloaded latest IDE 1.5.5 where is servo library included.

I have opened example sketch "sweep" and during compilation it shows this error:

C:\Users\Miro\Documents\Arduino\libraries\Servo\Servo.cpp:103: error: expected constructor, destructor, or type conversion before '(' token
C:\Users\Miro\Documents\Arduino\libraries\Servo\Servo.cpp: In function 'void initISR(timer16_Sequence_t)':
C:\Users\Miro\Documents\Arduino\libraries\Servo\Servo.cpp:151: error: 'TCCR1A' was not declared in this scope
C:\Users\Miro\Documents\Arduino\libraries\Servo\Servo.cpp:152: error: 'TCCR1B' was not declared in this scope
C:\Users\Miro\Documents\Arduino\libraries\Servo\Servo.cpp:152: error: 'CS11' was not declared in this scope
C:\Users\Miro\Documents\Arduino\libraries\Servo\Servo.cpp:152: error: '_BV' was not declared in this scope
C:\Users\Miro\Documents\Arduino\libraries\Servo\Servo.cpp:153: error: 'TCNT1' was not declared in this scope
C:\Users\Miro\Documents\Arduino\libraries\Servo\Servo.cpp:159: error: 'TIFR1' was not declared in this scope
C:\Users\Miro\Documents\Arduino\libraries\Servo\Servo.cpp:159: error: 'OCF1A' was not declared in this scope
C:\Users\Miro\Documents\Arduino\libraries\Servo\Servo.cpp:160: error: 'TIMSK1' was not declared in this scope
C:\Users\Miro\Documents\Arduino\libraries\Servo\Servo.cpp:160: error: 'OCIE1A' was not declared in this scope
C:\Users\Miro\Documents\Arduino\libraries\Servo\Servo.cpp: In member function 'void Servo::writeMicroseconds(int)':
C:\Users\Miro\Documents\Arduino\libraries\Servo\Servo.cpp:311: error: 'SREG' was not declared in this scope
C:\Users\Miro\Documents\Arduino\libraries\Servo\Servo.cpp:312: error: 'cli' was not declared in this scope

When I choose board Arduino Mega this error disappear:(

Anyone have any advice?
Thank you in advance. Best regards Miro

EliteEng

These errors say that it is using a library made for an AVR chip ( uno, mega )

There is supposed to be a library for the due, you may need to delete the library in your documents\arduino\libraries folder

MarkT

1.5 distribution should not be sharing anything with 1.0 distributions, lots of things
are moved about and restructured...
[ I won't respond to messages, use the forum please ]

zmatek

So question is what I have done wrong?

I did not any changes, I have installed latest IDE release 1.5.5
I loaded default example, setup up correct port , DUE programming port and that error occurs    :smiley-roll:

I also tried to use IDE 1.5.2r2 and library from GITHUB manually uploaded into ...arduino/hardware/arduino/sam/library
Also does not work for me...

Does this library work for you guys with DUE? Is there needed some modification?
I have been looking for a solution in the google for 3 hours at least, but it seems nobody has similar problem with IDE 1.5.1 and above.
I am working in Windows 7 64bit system if is it matter.
I can control servo without library of course, but I think that software timer for PPM generation will consume a lot of CPU capacity.

So once more again, thank you for any help. Miro

zmatek


These errors say that it is using a library made for an AVR chip ( uno, mega )

There is supposed to be a library for the due, you may need to delete the library in your documents\arduino\libraries folder


Hi dude,

thanks a lot you were absolutelly right.
I have deleted files in this folder: \Arduino\libraries\Servo\arch\avr\
And problem with compilation disapperas: )

However still we have a question, why IDE used these files for AVR instead of files for SAM when DUE board selected :)


Go Up