Skip to content

Arduino Wifi Rev 2 - incompatibility between Tone and Servo #9122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dcuartielles opened this issue Aug 5, 2019 · 2 comments
Closed

Arduino Wifi Rev 2 - incompatibility between Tone and Servo #9122

dcuartielles opened this issue Aug 5, 2019 · 2 comments
Assignees
Labels
Library: Servo The Servo Arduino library Type: Bug

Comments

@dcuartielles
Copy link
Member

It is not possible to add a call to tone and, at the same time, invoke the servo. Seems like they are using the same timer. Simply try the following example to replicate the issue:

#include <Servo.h>

void setup() {
  // put your setup code here, to run once:
  pinMode(10, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  tone(10, 900);
}

This will produce the result:

Tone.cpp.o (symbol from plugin): In function `tone(unsigned char, unsigned int, unsigned long)':
Se encontraron varias bibliotecas para "Servo.h"
(.text+0x0): multiple definition of `__vector_13'
libraries/Servo/megaavr/Servo.cpp.o (symbol from plugin):(.text+0x0): first defined here
Usado: /home/topeka/Arduino/libraries/Servo
collect2: error: ld returned 1 exit status
 No usado: /home/topeka/Development/arduino-1.8.9/libraries/Servo
exit status 1
Error compilando para la tarjeta Arduino Uno WiFi Rev2.

@dcuartielles
Copy link
Member Author

One possible solution would be changing the megaaver/ServoTimers.h to be using a different timer, e.g.

//#define USE_TIMERB1        // interferes with PWM on pin 3
#define USE_TIMERB2        // interferes with PWM on pin 11
//#define USE_TIMERB0        // interferes with PWM on pin 6

But I am not sure whether this would provoke an issue somewhere else.

Note: this is needed for the EduIntro library to work

@dcuartielles dcuartielles added Library: Servo The Servo Arduino library Type: Bug labels Aug 5, 2019
dcuartielles added a commit to dcuartielles/Servo that referenced this issue Aug 5, 2019
Fixed issue arduino/Arduino#9122 when using Servo and Tone with megaavr4089.
@facchinm
Copy link
Member

facchinm commented Aug 6, 2019

Fixed by merging arduino-libraries/Servo#30

@facchinm facchinm closed this as completed Aug 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Library: Servo The Servo Arduino library Type: Bug
Projects
None yet
Development

No branches or pull requests

4 participants