Skip to content

PWMServo no compile with arduino board DUE #7

@claudius310

Description

@claudius310

Description

To standardize my programs between Arduino and Tennsy board, I wanted to use the PWMServo library.
But when compiling with the arduino DUE board I got an error

Steps To Reproduce Problem

When I compile the program for the arduino DUE board I still have the problem

Hardware & Software

Board : Arduino DUE
Shields / modules used : None
Arduino IDE version : 2.1.0
Version info & package name (from Tools > Boards > Board Manager): PWMServo 2.1
Operating system & version : W10

Arduino Sketch

`// Sweep
// by BARRAGAN http://barraganstudio.com

// http://arduiniana.org/libraries/pwmservo/

// Board SERVO_PIN_A SERVO_PIN_B SERVO_PIN_C
// ----- ----------- ----------- -----------
// Arduino Uno, Duemilanove 9 10 (none)
// Arduino Mega 11 12 13
// Sanguino 13 12 (none)
// Teensy 1.0 17 18 15
// Teensy 2.0 14 15 4
// Teensy++ 1.0 or 2.0 25 26 27
// Teensy LC & 3.x (all PWM pins are usable)

#include <PWMServo.h>

PWMServo myservo; // create servo object to control a servo

int pos = 0; // variable to store the servo position

void setup() {
myservo.attach(10); // attache la sortie en position 10
//myservo.attach(SERVO_PIN_A); // attaches the servo on pin 9 to the servo object
//myservo.attach(SERVO_PIN_A, 1000, 2000); // some motors need min/max setting
}

void loop() {
for(pos = 0; pos < 180; pos += 1) { // goes from 0 degrees to 180 degrees, 1 degree steps
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1) { // goes from 180 degrees to 0 degrees
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}`

Errors or Incorrect Output

C:\Users\jcc\AppData\Local\Temp\arduino\sketches\EB2A7818D17AFC4525D1732E448F1387\sketch\servo_tennsy3.6.ino.cpp.o: In function PWMServo::attach(int)': c:\Users\jcc\Documents\Arduino\libraries\PWMServo/PWMServo.h:81: undefined reference to PWMServo::attach(int, int, int)'
C:\Users\jcc\AppData\Local\Temp\arduino\sketches\EB2A7818D17AFC4525D1732E448F1387\sketch\servo_tennsy3.6.ino.cpp.o: In function loop': C:\Users\jcc\Desktop\Arduino SD1 provisoire travail\Tennsy\servo_tennsy3.6/servo_tennsy3.6.ino:31: undefined reference to PWMServo::write(int)'
C:\Users\jcc\Desktop\Arduino SD1 provisoire travail\Tennsy\servo_tennsy3.6/servo_tennsy3.6.ino:35: undefined reference to PWMServo::write(int)' C:\Users\jcc\AppData\Local\Temp\arduino\sketches\EB2A7818D17AFC4525D1732E448F1387\sketch\servo_tennsy3.6.ino.cpp.o: In function __static_initialization_and_destruction_0':
C:\Users\jcc\Desktop\Arduino SD1 provisoire travail\Tennsy\servo_tennsy3.6/servo_tennsy3.6.ino:18: undefined reference to `PWMServo::PWMServo()'
collect2.exe: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions