Pages: [1]   Go Down
Author Topic: Servo library + timer library?  (Read 1264 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 15
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I'm trying to operate a few servos simultaneously without using the delay() function. I want to use a timer library to rotate a servo back to its starting positions after a set delay. However I want to operate other servos during that delay.

I've experimented with a couple of timer libraries posted here. However as far as I understand the timer libraries and the servo library use the same hardware timers on the Due. Consequently, the Arduino IDE would not let me compile while using both libraries.

What are some possible workaround for this? I need to operate 11 servos total, maybe 3 of them simultaneously.
Logged

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

bump!
Logged

Brasil
Offline Offline
Full Member
***
Karma: 4
Posts: 125
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you detail the problem? I mean, what happens when you create both Servo and Timer? No one works, the last one works...

And also, have you tried using others timers (0,1,2,3,4,5,6,7,8)?

Did you used my library? github.com/ivanseidel/DueTimer

Ivan
Logged


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

Hi,
I have the same problem as motomoto. When I include both DueTimer.h and Servo.h, I get:
Code:
sam\Servo.cpp.o: In function `TC0_Handler':
C:\Program Files (x86)\Arduino-1.0.5\Arduino\libraries\Servo\arch\sam/Servo.cpp:75: multiple definition of `TC0_Handler'
DueTimer_master\DueTimer.cpp.o:C:\Users\sydian\Documents\Arduino\libraries\DueTimer_master/DueTimer.cpp:231: first defined here
sam\Servo.cpp.o: In function `TC2_Handler':
C:\Program Files (x86)\Arduino-1.0.5\Arduino\libraries\Servo\arch\sam/Servo.cpp:70: multiple definition of `TC2_Handler'
DueTimer_master\DueTimer.cpp.o:C:\Users\sydian\Documents\Arduino\libraries\DueTimer_master/DueTimer.cpp:239: first defined here
sam\Servo.cpp.o: In function `TC5_Handler':
C:\Program Files (x86)\Arduino-1.0.5\Arduino\libraries\Servo\arch\sam/Servo.cpp:65: multiple definition of `TC5_Handler'
DueTimer_master\DueTimer.cpp.o:C:\Users\sydian\Documents\Arduino\libraries\DueTimer_master/DueTimer.cpp:251: first defined here
sam\Servo.cpp.o: In function `TC4_Handler':
C:\Program Files (x86)\Arduino-1.0.5\Arduino\libraries\Servo\arch\sam/Servo.cpp:60: multiple definition of `TC4_Handler'
DueTimer_master\DueTimer.cpp.o:C:\Users\sydian\Documents\Arduino\libraries\DueTimer_master/DueTimer.cpp:247: first defined here
sam\Servo.cpp.o: In function `TC3_Handler':
C:\Program Files (x86)\Arduino-1.0.5\Arduino\libraries\Servo\arch\sam/Servo.cpp:55: multiple definition of `TC3_Handler'
DueTimer_master\DueTimer.cpp.o:C:\Users\sydian\Documents\Arduino\libraries\DueTimer_master/DueTimer.cpp:243: first defined here
collect2: ld returned 1 exit status
Has someone any clue how to avoid this ?
Logged

Brasil
Offline Offline
Full Member
***
Karma: 4
Posts: 125
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

Because there are some people with this problem, I made a modification on DueTimer that will allow you to put to work both Servo and DueTimer together.

I didn't have time to test, but I'm pretty sure everything will work just fine.

Here is the documentation on how to make it work: https://github.com/ivanseidel/DueTimer#compatibility-with-servoh
Logged


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

ivanseidel,
I tested it and it works for my project.
Many thanks and keep on the good work!
Logged

Brasil
Offline Offline
Full Member
***
Karma: 4
Posts: 125
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

ivanseidel,
I tested it and it works for my project.
Many thanks and keep on the good work!

Thanks! Nice that it worked and helped...

Ivan
Logged


Pages: [1]   Go Up
Jump to: