Iron Man Box and Loop helmet code issues

Hello all,

Im totally new to Arduino and have never used it before now, i recently purchased a 3D printer and I've been making the Box and loop Ironman MK 5 helmet (free download on thingiverse) however I've gone to compile to the code that is provided on the instructions and i get the following message:


/Users/deangoldingperello/Documents/Arduino/Iron_man_mask/Iron_man_mask.ino:1:26: warning: extra tokens at end of #include directive
 #include "ServoEasing.h" ServoEasing servoTop; ServoEasing servoBottom;
                          ^~~~~~~~~~~
In file included from /Users/deangoldingperello/Documents/Arduino/Iron_man_mask/Iron_man_mask.ino:1:0:
/Users/deangoldingperello/Documents/Arduino/libraries/ServoEasing/src/ServoEasing.h:837: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.
  ^~~~~~~
/Users/deangoldingperello/Documents/Arduino/Iron_man_mask/Iron_man_mask.ino: In function 'void setup()':
Iron_man_mask:10:1: error: 'servoTop' was not declared in this scope
 servoTop.attach(9);
 ^~~~~~~~
/Users/deangoldingperello/Documents/Arduino/Iron_man_mask/Iron_man_mask.ino:10:1: note: suggested alternative: 'servo_t'
 servoTop.attach(9);
 ^~~~~~~~
 servo_t
Iron_man_mask:11:1: error: 'servoBottom' was not declared in this scope
 servoBottom.attach(10);
 ^~~~~~~~~~~
/Users/deangoldingperello/Documents/Arduino/Iron_man_mask/Iron_man_mask.ino:11:1: note: suggested alternative: 'servo_t'
 servoBottom.attach(10);
 ^~~~~~~~~~~
 servo_t
/Users/deangoldingperello/Documents/Arduino/Iron_man_mask/Iron_man_mask.ino: In function 'void loop()':
Iron_man_mask:19:31: error: 'servoTop' was not declared in this scope
 if (location > bottom_open) { servoTop.setEaseTo(top_open); servoBottom.setEaseTo(bottom_open); synchronizeAllServosStartAndWaitForAllServosToStop(); location = bottom_open;
                               ^~~~~~~~
/Users/deangoldingperello/Documents/Arduino/Iron_man_mask/Iron_man_mask.ino:19:31: note: suggested alternative: 'servo_t'
 if (location > bottom_open) { servoTop.setEaseTo(top_open); servoBottom.setEaseTo(bottom_open); synchronizeAllServosStartAndWaitForAllServosToStop(); location = bottom_open;
                               ^~~~~~~~
                               servo_t
Iron_man_mask:19:61: error: 'servoBottom' was not declared in this scope
 if (location > bottom_open) { servoTop.setEaseTo(top_open); servoBottom.setEaseTo(bottom_open); synchronizeAllServosStartAndWaitForAllServosToStop(); location = bottom_open;
                                                             ^~~~~~~~~~~
/Users/deangoldingperello/Documents/Arduino/Iron_man_mask/Iron_man_mask.ino:19:61: note: suggested alternative: 'servo_t'
 if (location > bottom_open) { servoTop.setEaseTo(top_open); servoBottom.setEaseTo(bottom_open); synchronizeAllServosStartAndWaitForAllServosToStop(); location = bottom_open;
                                                             ^~~~~~~~~~~
                                                             servo_t
Iron_man_mask:22:1: error: 'servoTop' was not declared in this scope
 servoTop.setEaseTo(top_closed); servoBottom.setEaseTo(bottom_closed); synchronizeAllServosStartAndWaitForAllServosToStop(); location = bottom_closed;
 ^~~~~~~~
/Users/deangoldingperello/Documents/Arduino/Iron_man_mask/Iron_man_mask.ino:22:1: note: suggested alternative: 'servo_t'
 servoTop.setEaseTo(top_closed); servoBottom.setEaseTo(bottom_closed); synchronizeAllServosStartAndWaitForAllServosToStop(); location = bottom_closed;
 ^~~~~~~~
 servo_t
Iron_man_mask:22:33: error: 'servoBottom' was not declared in this scope
 servoTop.setEaseTo(top_closed); servoBottom.setEaseTo(bottom_closed); synchronizeAllServosStartAndWaitForAllServosToStop(); location = bottom_closed;
                                 ^~~~~~~~~~~
/Users/deangoldingperello/Documents/Arduino/Iron_man_mask/Iron_man_mask.ino:22:33: note: suggested alternative: 'servo_t'
 servoTop.setEaseTo(top_closed); servoBottom.setEaseTo(bottom_closed); synchronizeAllServosStartAndWaitForAllServosToStop(); location = bottom_closed;
                                 ^~~~~~~~~~~
                                 servo_t
exit status 1
'servoTop' was not declared in this scope

The code I've used is as follows:

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

I hope I've posted this in the correct section and that you guys could give me some help and advice on where i can correct the code so that i can compile it and upload it to the Arduino Nano that I've bought for the project

what happens if you separate things on the first line

#include "ServoEasing.hpp" 
ServoEasing servoTop; 
ServoEasing servoBottom;

:slight_smile:

cool

Legend, it compiled!!!!!

we want pictures of the finished product with you inside :slight_smile:

I tried it and didn't have any luck. Getting a "servoeasing.hpp no such file or directory. Also a noob with arduino.

you are probably missing a library (such as GitHub - ArminJo/ServoEasing: Arduino library to enable smooth servo movement. - not sure if this is the one)

read https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries and

Also take the time to read How to get the best out of this forum and post accordingly