I have a broken code an 0 experience

I'm trying to finish a iroman helmet the code was supplied all I was supposed to have to do was input it and I'm getting error messages. I spent 2 hrs trying to figure out what's wrong last night. I'd appreciate some assistance.

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

This is what I was given...

It's causing all the error codes I uploaded an more. I dont quite understand why the ServoEasing isn't working I went to tools and downloaded it, it's Installed. I'm at a loss. I'm not even sure I'm posting this in the right place :sweat_smile: thanks everyone

Click on the 'copy error messages' box in the code editing window. Paste the results here. State which Arduino you're using.

image

Look at the examples that come with the library. Look carefully at the file(s) that are included. #include "ServoEasing.hpp" Not #include "ServoEasing.h" See the .hpp?

I fix that and it compiles for an Uno.

Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.

Please include the entire error message. It is easy to do. There is a button (lower right of the IDE window) called "copy error message". Copy the error and paste into a post in code tags, not a screen shot. Paraphrasing the error message leaves out important information.

Arduino: 1.8.16 (Windows 10), Board: "Arduino Nano Every, None (ATMEGA4809)"

C:\Users\brand\AppData\Local\Temp\ccUKFLkP.ltrans0.ltrans.o: In function `setup':

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:20: undefined reference to `ServoEasing::attach(int)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:21: undefined reference to `ServoEasing::attach(int)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:22: undefined reference to `setSpeedForAllServos(unsigned int)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:23: undefined reference to `ServoEasing::setEasingType(unsigned char)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:24: undefined reference to `ServoEasing::setEasingType(unsigned char)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:25: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'

C:\Users\brand\AppData\Local\Temp\ccUKFLkP.ltrans0.ltrans.o: In function `loop':

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:35: undefined reference to `ServoEasing::setEaseTo(int)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:36: undefined reference to `ServoEasing::setEaseTo(int)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:37: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:42: undefined reference to `ServoEasing::setEaseTo(int)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:43: undefined reference to `ServoEasing::setEaseTo(int)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:44: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'

C:\Users\brand\AppData\Local\Temp\ccUKFLkP.ltrans0.ltrans.o: In function `_GLOBAL__sub_I_servoTop':

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:4: undefined reference to `ServoEasing::ServoEasing()'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:5: undefined reference to `ServoEasing::ServoEasing()'

collect2.exe: error: ld returned 1 exit status

exit status 1

Error compiling for board Arduino Nano Every.

C:\Users\brand\AppData\Local\Temp\cccLEpvP.ltrans0.ltrans.o: In function `setup':

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:20: undefined reference to `ServoEasing::attach(int)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:21: undefined reference to `ServoEasing::attach(int)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:22: undefined reference to `setSpeedForAllServos(unsigned int)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:23: undefined reference to `ServoEasing::setEasingType(unsigned char)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:24: undefined reference to `ServoEasing::setEasingType(unsigned char)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:25: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'

C:\Users\brand\AppData\Local\Temp\cccLEpvP.ltrans0.ltrans.o: In function `loop':

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:35: undefined reference to `ServoEasing::setEaseTo(int)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:36: undefined reference to `ServoEasing::setEaseTo(int)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:37: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:42: undefined reference to `ServoEasing::setEaseTo(int)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:43: undefined reference to `ServoEasing::setEaseTo(int)'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:44: undefined reference to `synchronizeAllServosStartAndWaitForAllServosToStop()'

C:\Users\brand\AppData\Local\Temp\cccLEpvP.ltrans0.ltrans.o: In function `_GLOBAL__sub_I_servoTop':

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:4: undefined reference to `ServoEasing::ServoEasing()'

C:\Users\brand\Documents\Arduino\uggggg/uggggg.ino:5: undefined reference to `ServoEasing::ServoEasing()'

collect2.exe: error: ld returned 1 exit status

Multiple libraries were found for "Servo.h"

Used: C:\Program Files (x86)\Arduino\libraries\Servo

Not used: C:\Users\brand\Documents\Arduino\libraries\ServoESP32

exit status 1

Error compiling for board Arduino Nano Every.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Did you read reply #3?

Or see reply #8 of this thread.

please explain:

why is everybody insisting on using the more complex methods for creating code-sections than this one?

You should post code by using code-tags
There is an automatic function for doing this in the Arduino-IDE
just three steps

  1. press Ctrl-T for autoformatting your code
  2. do a rightclick with the mouse and choose "copy for forum"
  3. paste clipboard into write-window of a posting

@Arduino-IDE-developper-Team:
add a function that does the same for error-messages. Any experienced user will be able to remove or ignore the [ code ] [ / code ] tags if they want to use the messages text for something else than posting in the forum

best regards Stefan

Hi, @onenotoriouscreator
Welcome to the forum.

What model Arduino are you using?

Can you please tell us your electronics, programming, arduino, hardware experience?

Where did you get the code?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

See title

@onenotoriouscreator

best regards Stefan

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