New to this and have very small experience with using arduinos. Maybe someone can help?

/usr/local/bin/arduino-cli compile --fqbn arduino:megaavr:nona4809:mode=on --libraries /home/builder/opt/libraries/latest --build-cache-path /tmp --output-dir /tmp/216572820/build --build-path /tmp/arduino-build-20F7358A69A7B381C308C26A0CC4901D /tmp/216572820/sketch_oct12b

Using library servoeasing_2_4_0 at version 2.4.0 in folder: /home/builder/opt/libraries/servoeasing_2_4_0

Using library servo_1_1_8 at version 1.1.8 in folder: /home/builder/opt/libraries/servo_1_1_8

/tmp/ccZZVtQp.ltrans0.ltrans.o: In function `setup':

/tmp/216572820/sketch_oct12b/sketch_oct12b.ino:24: undefined reference to `ServoEasing::attach(int)'

/tmp/216572820/sketch_oct12b/sketch_oct12b.ino:25: undefined reference to `ServoEasing::attach(int)'

/tmp/216572820/sketch_oct12b/sketch_oct12b.ino:26: undefined reference to `setSpeedForAllServos(unsigned int)'

/tmp/216572820/sketch_oct12b/sketch_oct12b.ino:27: undefined reference to `ServoEasing::setEasingType(unsigned char)'

/tmp/216572820/sketch_oct12b/sketch_oct12b.ino:28: undefined reference to `ServoEasing::setEasingType(unsigned char)'

/tmp/216572820/sketch_oct12b/sketch_oct12b.ino:29: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'

/tmp/ccZZVtQp.ltrans0.ltrans.o: In function `loop':

/tmp/216572820/sketch_oct12b/sketch_oct12b.ino:39: undefined reference to `ServoEasing::setEaseTo(int)'

/tmp/216572820/sketch_oct12b/sketch_oct12b.ino:40: undefined reference to `ServoEasing::setEaseTo(int)'

/tmp/216572820/sketch_oct12b/sketch_oct12b.ino:41: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'

/tmp/216572820/sketch_oct12b/sketch_oct12b.ino:46: undefined reference to `ServoEasing::setEaseTo(int)'

/tmp/216572820/sketch_oct12b/sketch_oct12b.ino:47: undefined reference to `ServoEasing::setEaseTo(int)'

/tmp/216572820/sketch_oct12b/sketch_oct12b.ino:48: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'

/tmp/ccZZVtQp.ltrans0.ltrans.o: In function `_GLOBAL__sub_I_servoTop':

/tmp/216572820/sketch_oct12b/sketch_oct12b.ino:8: undefined reference to `ServoEasing::ServoEasing()'

/tmp/216572820/sketch_oct12b/sketch_oct12b.ino:9: undefined reference to `ServoEasing::ServoEasing()'

collect2: error: ld returned 1 exit status

Error during build: exit status 1

You've got issues with the code you didn't post

Here you go

#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); } } }

I'm guessing you haven't installed the ServoEasing library correctly (I've never heard of it)

Please remember to use code tags when posting code

I included the ServoEasing libarary but i have no more idea what i did wrong

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

@bicol79987, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

Have a look at the examples and check what what you need to #include in the sketch. It's not #include "ServoEasing.h" but #include "ServoEasing.hpp".

I'm not sure how you ended up with one massive line of code but this is what it should look like in the forum if you post code properly (it includes the fix)

#include "ServoEasing.hpp"

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);
    }
  }
}

Neither did I but it's even in the reference :slight_smile: ServoEasing - Arduino Reference

1 Like

Thank you very much! If anyone was interested what the code was for https://www.thingiverse.com/thing:4629346

Cheers