Pages: [1]   Go Down
Author Topic: Servo library for the due... does exist?  (Read 4003 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

By having on my program the following line:
   #include <Servo.h>

I get the compiler error under the Arduino IDE (1.5.1r2)
   vex_motor.ino:1: fatal error: Servo.h: No such file or directory
   compilation terminated.


The board is an Arduino Due.

Was the Servo library ported to the Arduino Due?... from the warning above, the answer may be no smiley-sad

Any hint?
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Was added a few days ago, search  back in this forum and you will find it, but here is the direct link -

https://github.com/arduino/Arduino/commit/db81f52c3a27784fb44ca1ad6c77f9b1f0a4ef7d

Duane B
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Was added a few days ago, search  back in this forum and you will find it, but here is the direct link -

https://github.com/arduino/Arduino/commit/db81f52c3a27784fb44ca1ad6c77f9b1f0a4ef7d

Duane B

Excellent, many thanks.

I'm not used to GIT, therefore, how can I download the files? (on my own risk), I guess I need to install this animal (git) and then get the files.

... just now saw the same link in the fourm..
Logged

Dubai, UAE
Offline Offline
Edison Member
*
Karma: 22
Posts: 1675
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Git looks like a pain to use to me also, but you should be able to cut and paste the code from the link.

Duane B

Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I tried using this servo library and I get this error when I try to compile:

Code:
In file included from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 ... (same thing repeated like 100 times) ...
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from sketch_dec09b.ino:6:
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:44: error: #include nested too deeply
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45: error: #include nested too deeply
In file included from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                ... (same thing repeated like 100 times) ...
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from sketch_dec09b.ino:6:
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:53: error: 'servo_t' does not name a type
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:57: error: '_Nbr_16timers' was not declared in this scope
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:76: error: variable or field 'Servo_Handler' declared void
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:76: error: 'timer16_Sequence_t' was not declared in this scope
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:76: error: expected primary-expression before '*' token
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:76: error: 'pTc' was not declared in this scope
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:76: error: expected primary-expression before 'channel'
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:103: error: variable or field 'Servo_Handler' declared void
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:103: error: 'timer16_Sequence_t' was not declared in this scope
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:103: error: expected primary-expression before '*' token
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:103: error: 'tc' was not declared in this scope
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:103: error: expected primary-expression before 'channel'

I used the Sweep example provided with this library, because I wanted to see if it was working properly... Compiled with IDE 1.5.1r2... Any ideas?
« Last Edit: December 09, 2012, 06:03:08 am by PLorand » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

I tried using this servo library and I get this error when I try to compile:

Code:
In file included from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 ... (same thing repeated like 100 times) ...
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from sketch_dec09b.ino:6:
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:44: error: #include nested too deeply
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45: error: #include nested too deeply
In file included from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                ... (same thing repeated like 100 times) ...
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:45,
                 from sketch_dec09b.ino:6:
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:53: error: 'servo_t' does not name a type
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:57: error: '_Nbr_16timers' was not declared in this scope
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:76: error: variable or field 'Servo_Handler' declared void
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:76: error: 'timer16_Sequence_t' was not declared in this scope
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:76: error: expected primary-expression before '*' token
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:76: error: 'pTc' was not declared in this scope
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:76: error: expected primary-expression before 'channel'
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:103: error: variable or field 'Servo_Handler' declared void
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:103: error: 'timer16_Sequence_t' was not declared in this scope
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:103: error: expected primary-expression before '*' token
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:103: error: 'tc' was not declared in this scope
C:\Users\Lori\Documents\Arduino\libraries\Servo/Servo.h:103: error: expected primary-expression before 'channel'

I used the Sweep example provided with this library, because I wanted to see if it was working properly... Compiled with IDE 1.5.1r2... Any ideas?

I'm new here also, but it seems that you saved the files in the wrong location.

The Servo.cpp and Servo.h  may need to go to  .../hardware/arduino/sam/libraries/Servo directory and not to ../libraries/Servo directory...

I downloaded the files, located them in the correct place and worked smiley

--- Ricky
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The "Servo" folder is located both in the "C:\Users\Lori\Documents\Arduino\libraries\Servo" and the "C:\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo". And the errors I got are not "File not found exceptions" or similar...

I've also tried removing the library from "C:\Users\Lori\Documents\Arduino\libraries\Servo" and just leaving the "C:\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo" and I'm still getting the same errors...
« Last Edit: December 09, 2012, 07:38:52 am by PLorand » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Investigating some more into these errors, it seems that the "#include <Arduino.h>" is "nested too deeply" (as the compiler says it). This would cause the rest of the errors from the bottom of the error list, like " 'servo_t' does not name a type", or " '_Nbr_16timers' was not declared in this scope", etc... Any ideas how to fix this?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The "Servo" folder is located both in the "C:\Users\Lori\Documents\Arduino\libraries\Servo" and the "C:\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo". And the errors I got are not "File not found exceptions" or similar...

I've also tried removing the library from "C:\Users\Lori\Documents\Arduino\libraries\Servo" and just leaving the "C:\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo" and I'm still getting the same errors...

I guess we both are talking about the "Arduino Due"... , I have added the following files:
- E:\Work\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo\Servo.h
- E:\Work\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo\Servo.cpp
- E:\Work\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo\keywords.txt
- E:\Work\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo\examples\Knob\Knob.ino
- E:\Work\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo\examples\Sweep\Sweep.ino

Now, from the error messages, it seems that the #ifndef Servo_h in line 45 is giving the hint. Do you have another Servo_h #define in some other place?.

On the Arduino IDE, did you select the correct board, otherwise you will be taking the avr files. (...\arduino-1.5.1r2\hardware\arduino\avr\libraries\Servo)

Just want to help.. I'm also new here, but for me the new files worked as required...

Have a nice day.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The "Servo" folder is located both in the "C:\Users\Lori\Documents\Arduino\libraries\Servo" and the "C:\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo". And the errors I got are not "File not found exceptions" or similar...

I've also tried removing the library from "C:\Users\Lori\Documents\Arduino\libraries\Servo" and just leaving the "C:\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo" and I'm still getting the same errors...

I guess we both are talking about the "Arduino Due"... , I have added the following files:
- E:\Work\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo\Servo.h
- E:\Work\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo\Servo.cpp
- E:\Work\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo\keywords.txt
- E:\Work\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo\examples\Knob\Knob.ino
- E:\Work\arduino-1.5.1r2\hardware\arduino\sam\libraries\Servo\examples\Sweep\Sweep.ino

Now, from the error messages, it seems that the #ifndef Servo_h in line 45 is giving the hint. Do you have another Servo_h #define in some other place?.

On the Arduino IDE, did you select the correct board, otherwise you will be taking the avr files. (...\arduino-1.5.1r2\hardware\arduino\avr\libraries\Servo)

Just want to help.. I'm also new here, but for me the new files worked as required...

Have a nice day.

SORRY! I'm the idiot... Mistakenly I've copied the contents of the .cpp file in the .h file, that's what was causing the problems... Maybe if it was easier to download files from Github, rather then copy-paste them piece-by-piece these mistakes wouldn't occur... Thanks for your help! smiley
« Last Edit: December 09, 2012, 11:20:49 am by PLorand » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe if it was easier to download files from Github, rather then copy-paste them piece-by-piece these mistakes wouldn't occur... Thanks for your help! smiley
Copy and Paste is one of the great enemies of a programmer smiley

I'm glad you found the problem.

Have a nice day

--- Ricky
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 6
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeah, definitely is!   smiley

1 question... I didn't have the time to go trough the library's code fully to see exactly how it's working. How many servos can you connect to the Due using this library?... Theoretically you should be able to connect a maximum of 10 servos per timer channel, let's say 8 to have some space to work with and avoid errors and we have channels 4,5,6 free, so those could be used to control 24 outputs. Now I don't know how this library works exactly yet, but does it synchronize the pulses such that it can use 8 outputs per channel and multiple channels for more then 8 outputs?..

Thanks for your help!
Logged

Pages: [1]   Go Up
Jump to: