Trying to upload code to nano

I am trying to upload a fairly simple code.
I have installed the servoeasing lib
here is the code

#include "ServoEasing.h"
ServoEasing servoTop;
ServoEasing servoBottom;
const int action_pin = 2;
int location = 31;
// Below numbers should be adjusted in case the facemask does not close/open to desired angle
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);
 }
 }
}

HERE ARE THE ERRORS

C:\Users\ALIENW~1\AppData\Local\Temp\ccmocYCk.ltrans0.ltrans.o: In function `setup':
C:\Users\Alienware\AppData\Local\Temp\.arduinoIDE-unsaved2024918-11712-tmmkxf.i79jf\sketch_oct18a/sketch_oct18a.ino:14: undefined reference to `ServoEasing::attach(int)'
C:\Users\Alienware\AppData\Local\Temp\.arduinoIDE-unsaved2024918-11712-tmmkxf.i79jf\sketch_oct18a/sketch_oct18a.ino:15: undefined reference to `ServoEasing::attach(int)'
C:\Users\Alienware\AppData\Local\Temp\.arduinoIDE-unsaved2024918-11712-tmmkxf.i79jf\sketch_oct18a/sketch_oct18a.ino:16: undefined reference to `setSpeedForAllServos(unsigned int)'
C:\Users\Alienware\AppData\Local\Temp\.arduinoIDE-unsaved2024918-11712-tmmkxf.i79jf\sketch_oct18a/sketch_oct18a.ino:17: undefined reference to `ServoEasing::setEasingType(unsigned char)'
C:\Users\Alienware\AppData\Local\Temp\.arduinoIDE-unsaved2024918-11712-tmmkxf.i79jf\sketch_oct18a/sketch_oct18a.ino:18: undefined reference to `ServoEasing::setEasingType(unsigned char)'
C:\Users\Alienware\AppData\Local\Temp\.arduinoIDE-unsaved2024918-11712-tmmkxf.i79jf\sketch_oct18a/sketch_oct18a.ino:19: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'
C:\Users\ALIENW~1\AppData\Local\Temp\ccmocYCk.ltrans0.ltrans.o: In function `loop':
C:\Users\Alienware\AppData\Local\Temp\.arduinoIDE-unsaved2024918-11712-tmmkxf.i79jf\sketch_oct18a/sketch_oct18a.ino:27: undefined reference to `ServoEasing::setEaseTo(int)'
C:\Users\Alienware\AppData\Local\Temp\.arduinoIDE-unsaved2024918-11712-tmmkxf.i79jf\sketch_oct18a/sketch_oct18a.ino:28: undefined reference to `ServoEasing::setEaseTo(int)'
C:\Users\Alienware\AppData\Local\Temp\.arduinoIDE-unsaved2024918-11712-tmmkxf.i79jf\sketch_oct18a/sketch_oct18a.ino:29: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'
C:\Users\Alienware\AppData\Local\Temp\.arduinoIDE-unsaved2024918-11712-tmmkxf.i79jf\sketch_oct18a/sketch_oct18a.ino:33: undefined reference to `ServoEasing::setEaseTo(int)'
C:\Users\Alienware\AppData\Local\Temp\.arduinoIDE-unsaved2024918-11712-tmmkxf.i79jf\sketch_oct18a/sketch_oct18a.ino:34: undefined reference to `ServoEasing::setEaseTo(int)'
C:\Users\Alienware\AppData\Local\Temp\.arduinoIDE-unsaved2024918-11712-tmmkxf.i79jf\sketch_oct18a/sketch_oct18a.ino:35: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'
C:\Users\ALIENW~1\AppData\Local\Temp\ccmocYCk.ltrans0.ltrans.o: In function `_GLOBAL__sub_I_servoTop':
C:\Users\Alienware\AppData\Local\Temp\.arduinoIDE-unsaved2024918-11712-tmmkxf.i79jf\sketch_oct18a/sketch_oct18a.ino:2: undefined reference to `ServoEasing::ServoEasing()'
C:\Users\Alienware\AppData\Local\Temp\.arduinoIDE-unsaved2024918-11712-tmmkxf.i79jf\sketch_oct18a/sketch_oct18a.ino:3: undefined reference to `ServoEasing::ServoEasing()'
collect2.exe: error: ld returned 1 exit status

exit status 1

Compilation error: exit status 1

Did you not notice the warning above the errors?

 #warning You probably must change the line #include "ServoEasing.h" to #include "ServoEasing.hpp" in your ino file or define SUPPRESS_HPP_WARNING before the include to suppress this warning.

Including ServoEasing.hpp instead of ServoEasing.h got your sketch to compile for me.

1 Like

Nope geez thanks man

WHere do you see that

Complete compile output follows:

arduino-cli compile -b arduino:avr:nano:cpu=atmega328 --warnings all --output-dir ~/tmp --no-color (in directory: /home/me/Documents/sketchbook/Nano/test)

In file included from /home/me/Documents/sketchbook/Nano/test/test.ino:1:0:
/home/me/Documents/sketchbook/libraries/ServoEasing/src/ServoEasing.h:930:2: warning: #warning You probably must change the line #include "ServoEasing.h" to #include "ServoEasing.hpp" in your ino file or define SUPPRESS_HPP_WARNING before the include to suppress this warning. [-Wcpp]
 #warning You probably must change the line #include "ServoEasing.h" to #include "ServoEasing.hpp" in your ino file or define SUPPRESS_HPP_WARNING before the include to suppress this warning.
  ^~~~~~~
/tmp/ccTK3itH.ltrans0.ltrans.o: In function `setup':
/home/me/Documents/sketchbook/Nano/test/test.ino:14: undefined reference to `ServoEasing::attach(int)'
/home/me/Documents/sketchbook/Nano/test/test.ino:15: undefined reference to `ServoEasing::attach(int)'
/home/me/Documents/sketchbook/Nano/test/test.ino:16: undefined reference to `setSpeedForAllServos(unsigned int)'
/home/me/Documents/sketchbook/Nano/test/test.ino:17: undefined reference to `ServoEasing::setEasingType(unsigned char)'
/home/me/Documents/sketchbook/Nano/test/test.ino:18: undefined reference to `ServoEasing::setEasingType(unsigned char)'
/home/me/Documents/sketchbook/Nano/test/test.ino:19: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'
/tmp/ccTK3itH.ltrans0.ltrans.o: In function `loop':
/home/me/Documents/sketchbook/Nano/test/test.ino:27: undefined reference to `ServoEasing::setEaseTo(int)'
/home/me/Documents/sketchbook/Nano/test/test.ino:28: undefined reference to `ServoEasing::setEaseTo(int)'
/home/me/Documents/sketchbook/Nano/test/test.ino:29: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'
/home/me/Documents/sketchbook/Nano/test/test.ino:33: undefined reference to `ServoEasing::setEaseTo(int)'
/home/me/Documents/sketchbook/Nano/test/test.ino:34: undefined reference to `ServoEasing::setEaseTo(int)'
/home/me/Documents/sketchbook/Nano/test/test.ino:35: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'
/tmp/ccTK3itH.ltrans0.ltrans.o: In function `_GLOBAL__sub_I_servoTop':
/home/me/Documents/sketchbook/Nano/test/test.ino:2: undefined reference to `ServoEasing::ServoEasing()'
/home/me/Documents/sketchbook/Nano/test/test.ino:3: undefined reference to `ServoEasing::ServoEasing()'
collect2: error: ld returned 1 exit status
Used library Version Path
ServoEasing  3.3.0   /home/me/Documents/sketchbook/libraries/ServoEasing
Servo        1.2.1   /home/me/Documents/sketchbook/libraries/Servo
Used platform Version Path
arduino:avr   1.8.3   /home/me/.arduino15/packages/arduino/hardware/avr/1.8.3
Error during build: exit status 1
Compilation failed.