Need help with undefined reference

#include "ServoEasing.h"

ServoEasing servoTop;

ServoEasing servoBottom;

const int action_pin = 2;

const int ledPin = 6;

const int potPin = A0;

int location = 31;

int bottom_closed = 107;

int top_closed = 167;

int bottom_open = 20;

int top_open = 20;

int value;

int maxBrightness;

void setup() {

pinMode(action_pin, INPUT_PULLUP);

pinMode(potPin, INPUT);

servoTop.attach(9);

servoBottom.attach(10);

setSpeedForAllServos(190);

servoTop.setEasingType(EASE_CUBIC_IN_OUT);

servoBottom.setEasingType(EASE_CUBIC_IN_OUT);

synchronizeAllServosStartAndWaitForAllServosToStop();

}

void loop() {

value = analogRead(potPin);

maxBrightness = map(value, 250, 750, 0, 255);

int proximity = digitalRead(action_pin);

if (proximity == LOW)

{

if (location > bottom_open) {

servoTop.setEaseTo(top_open);

servoBottom.setEaseTo(bottom_open);

synchronizeAllServosStartAndWaitForAllServosToStop();

location = bottom_open;

delay(10);

analogWrite(ledPin, 0);

} else {

servoTop.setEaseTo(top_closed);

servoBottom.setEaseTo(bottom_closed);

synchronizeAllServosStartAndWaitForAllServosToStop();

location = bottom_closed;

delay(50);

analogWrite(ledPin, maxBrightness / 3);

delay(100);

analogWrite(ledPin, maxBrightness / 5);

delay(100);

analogWrite(ledPin, maxBrightness / 2);

delay(100);

analogWrite(ledPin, maxBrightness / 3);

delay(100);

analogWrite(ledPin, maxBrightness);

delay(100);

}

}

}

C:\Users\Tswan\AppData\Local\Temp\ccVZVXHo.ltrans0.ltrans.o: In function setup': C:\Users\Tswan\OneDrive\Documents\Arduino\sketch_oct3i/sketch_oct3i.ino:18: undefined reference to ServoEasing::attach(int)'
C:\Users\Tswan\OneDrive\Documents\Arduino\sketch_oct3i/sketch_oct3i.ino:19: undefined reference to ServoEasing::attach(int)' C:\Users\Tswan\OneDrive\Documents\Arduino\sketch_oct3i/sketch_oct3i.ino:20: undefined reference to setSpeedForAllServos(unsigned int)'
C:\Users\Tswan\OneDrive\Documents\Arduino\sketch_oct3i/sketch_oct3i.ino:21: undefined reference to ServoEasing::setEasingType(unsigned char)' C:\Users\Tswan\OneDrive\Documents\Arduino\sketch_oct3i/sketch_oct3i.ino:22: undefined reference to ServoEasing::setEasingType(unsigned char)'
C:\Users\Tswan\OneDrive\Documents\Arduino\sketch_oct3i/sketch_oct3i.ino:23: undefined reference to synchronizeAllServosStartAndWaitForAllServosToStop()' C:\Users\Tswan\AppData\Local\Temp\ccVZVXHo.ltrans0.ltrans.o: In function loop':
C:\Users\Tswan\OneDrive\Documents\Arduino\sketch_oct3i/sketch_oct3i.ino:33: undefined reference to ServoEasing::setEaseTo(int)' C:\Users\Tswan\OneDrive\Documents\Arduino\sketch_oct3i/sketch_oct3i.ino:34: undefined reference to ServoEasing::setEaseTo(int)'
C:\Users\Tswan\OneDrive\Documents\Arduino\sketch_oct3i/sketch_oct3i.ino:35: undefined reference to synchronizeAllServosStartAndWaitForAllServosToStop()' C:\Users\Tswan\OneDrive\Documents\Arduino\sketch_oct3i/sketch_oct3i.ino:40: undefined reference to ServoEasing::setEaseTo(int)'
C:\Users\Tswan\OneDrive\Documents\Arduino\sketch_oct3i/sketch_oct3i.ino:41: undefined reference to ServoEasing::setEaseTo(int)' C:\Users\Tswan\OneDrive\Documents\Arduino\sketch_oct3i/sketch_oct3i.ino:42: undefined reference to synchronizeAllServosStartAndWaitForAllServosToStop()'
C:\Users\Tswan\AppData\Local\Temp\ccVZVXHo.ltrans0.ltrans.o: In function _GLOBAL__sub_I_servoTop': C:\Users\Tswan\OneDrive\Documents\Arduino\sketch_oct3i/sketch_oct3i.ino:2: undefined reference to ServoEasing::ServoEasing()'
C:\Users\Tswan\OneDrive\Documents\Arduino\sketch_oct3i/sketch_oct3i.ino:3: undefined reference to `ServoEasing::ServoEasing()'
collect2.exe: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1

you haven’t added files properly to your project most likely, give more details

Hello swanny21364

You may start with a tutorial how to use the mentioned libary to gain the knowledge how to.

Read the forum guidelines and post the code accordingly.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.