Help with servo code in Arduino IDE [Solved]

I'm new to Arduinos and when I try to upload this code I get a error notification saying:

"collect2.exe: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1"

I'm not sure what this means or how to fix it. if anybody could help I would really appreciate it.

The code is:

#include "ServoEasing.h"
ServoEasing servoTop;
ServoEasing servoBottom;
const int action_pin = 2;
int location = 31;``
int bottom_closed = 107;
int top_closed = 167;
int bottom_open = 20;
int top_open = 20;
void setup()
{
 pinMode(action_pin, INPUT_PULLUP);
 servoTop.attach(9);
 servoBottom.attach(10);
 setSpeedForAllServos(190);
 servoTop.setEasingType(EASE_CUBIC_IN_OUT);
 servoBottom.setEasingType(EASE_CUBIC_IN_OUT);
 synchronizeAllServosStartAndWaitForAllServosToStop();
}
void loop()
{
 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(600);
 } else {
 servoTop.setEaseTo(top_closed);
 servoBottom.setEaseTo(bottom_closed);
 synchronizeAllServosStartAndWaitForAllServosToStop();
 location = bottom_closed;
 delay(600);
 }
 }
}

It seems you have only posted the last part of the error message. Please post the full error message.

Your topic is not related to avrdude nor to stk500 nor to bootloader issues; it's the last step of the verify process where parts of the final program get linked together. Therefore I've moved your topic to a more suitable section of the forum.

Thank for using code tags in your first post :+1:

Thank you so much for helping. I did not realize it was only the last part so thank you for telling me. The rest of it is:

C:\Users\elcho\AppData\Local\Temp\ccUDTTog.ltrans0.ltrans.o: In function `_GLOBAL__sub_I_servoTop':
C:\Users\elcho\AppData\Local\Temp\.arduinoIDE-unsaved2024220-18164-1dxwbod.iy2a\sketch_mar20a/sketch_mar20a.ino:2: undefined reference to `ServoEasing::ServoEasing()'
C:\Users\elcho\AppData\Local\Temp\.arduinoIDE-unsaved2024220-18164-1dxwbod.iy2a\sketch_mar20a/sketch_mar20a.ino:3: undefined reference to `ServoEasing::ServoEasing()'
collect2.exe: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1

I was told to download a library which I did do. Just telling you incase that is mentioned in the error above.

You may not have installed the library properly.
How to install an Arduino library,

It is always best to install with the library manager if possible.

It seems I did not include the library when I was uploading. It seems to be working now. Thank you so much for all your help.

If your question has been answered to your satisfaction, please mark the thread as solved so that members that may want to help do not waste time opening the thread only to find no help needed.

1 Like

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