Hello,
I'm trying to control a 360 servo with wifi using an Arduino Nano ESP32 for a school project.
I'm using the IOT cloud to write and compile the code, however I'm getting errors which I don't understand.
Here's the code:
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/aa9f01b6-4a4f-4c99-a366-709952cbed81
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
int servo;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
#include <Servo.h>
Servo myservo;
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
myservo.attach(12);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
// Your code here
}
/*
Since Servo is READ_WRITE variable, onServoChange() is
executed every time a new value is received from IoT Cloud.
*/
void onServoChange() {
// Add your code here to act upon Servo change
myservo.write(servo);
}
And the errors:
In file included from /tmp/4061906368/Untitled_nov20b/Untitled_nov20b.ino:18: /home/builder/Arduino/libraries/servoesp32_1_1_1/src/Servo.h:68:81: error: call to non-'constexpr' function 'const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]' static const int TIMER_RESOLUTION = std::min(16, SOC_LEDC_TIMER_BIT_WIDE_NUM); ^ /home/builder/Arduino/libraries/servoesp32_1_1_1/src/Servo.h: In member function 'T ServoTemplate<T>::mapTemplate(T, T, T, T, T) const': /home/builder/Arduino/libraries/servoesp32_1_1_1/src/Servo.h:256:28: error: 'is_floating_point_v' is not a member of 'std' if constexpr (std::is_floating_point_v<T>) { ^~~~~~~~~~~~~~~~~~~ /home/builder/Arduino/libraries/servoesp32_1_1_1/src/Servo.h:256:28: note: suggested alternative: 'is_floating_point' if constexpr (std::is_floating_point_v<T>) { ^~~~~~~~~~~~~~~~~~~ is_floating_point /home/builder/Arduino/libraries/servoesp32_1_1_1/src/Servo.h:256:49: error: expected primary-expression before '>' token if constexpr (std::is_floating_point_v<T>) { ^ /home/builder/Arduino/libraries/servoesp32_1_1_1/src/Servo.h:256:50: error: expected primary-expression before ')' token if constexpr (std::is_floating_point_v<T>) { ^ Multiple libraries were found for "WiFiClientSecure.h" Used: /home/builder/.arduino15/packages/arduino/hardware/esp32/2.0.11/libraries/WiFiClientSecure Not used: /home/builder/opt/libraries/seeed_arduino_rpcwifi_1_0_6 Multiple libraries were found for "Servo.h" Used: /home/builder/opt/libraries/servoesp32_1_1_1 Not used: /home/builder/opt/libraries/servo_1_2_1 Not used: /home/builder/opt/libraries/microbitv2_hhs_0_1_6 Not used: /home/builder/opt/libraries/xmc_servo_1_0_1 Not used: /home/builder/opt/libraries/rokitsmart_1_0_9 Not used: /home/builder/opt/libraries/printoo_library_1_0_2 Not used: /home/builder/opt/libraries/esp32_esp32s2_analogwrite_5_0_2 Not used: /home/builder/opt/libraries/evive_2_0_3 Multiple libraries were found for "WiFi.h" Used: /home/builder/.arduino15/packages/arduino/hardware/esp32/2.0.11/libraries/WiFi Not used: /home/builder/opt/libraries/nina_wi_fi_1_0_0 Not used: /home/builder/opt/libraries/indhilib_3_0_5 Not used: /home/builder/opt/libraries/vega_wifinina_1_0_1 Not used: /home/builder/opt/libraries/da16200_wi_fi_library_for_arduino_1_1_0 Not used: /home/builder/opt/libraries/wifiespat_1_4_3 Not used: /home/builder/opt/libraries/wifi_1_2_7 Not used: /home/builder/opt/libraries/seeed_arduino_rpcwifi_1_0_6 Not used: /home/builder/opt/libraries/wifinina_1_8_14 Error during build: exit status 1
In file included from /tmp/4061906368/Untitled_nov20b/Untitled_nov20b.ino:18: /home/builder/Arduino/libraries/servoesp32_1_1_1/src/Servo.h:68:81: error: call to non-'constexpr' function 'const _Tp& std::min(const _Tp&, const _Tp&) [with _Tp = int]' static const int TIMER_RESOLUTION = std::min(16, SOC_LEDC_TIMER_BIT_WIDE_NUM); ^ /home/builder/Arduino/libraries/servoesp32_1_1_1/src/Servo.h: In member function 'T ServoTemplate<T>::mapTemplate(T, T, T, T, T) const': /home/builder/Arduino/libraries/servoesp32_1_1_1/src/Servo.h:256:28: error: 'is_floating_point_v' is not a member of 'std' if constexpr (std::is_floating_point_v<T>) { ^~~~~~~~~~~~~~~~~~~ /home/builder/Arduino/libraries/servoesp32_1_1_1/src/Servo.h:256:28: note: suggested alternative: 'is_floating_point' if constexpr (std::is_floating_point_v<T>) { ^~~~~~~~~~~~~~~~~~~ is_floating_point /home/builder/Arduino/libraries/servoesp32_1_1_1/src/Servo.h:256:49: error: expected primary-expression before '>' token if constexpr (std::is_floating_point_v<T>) { ^ /home/builder/Arduino/libraries/servoesp32_1_1_1/src/Servo.h:256:50: error: expected primary-expression before ')' token if constexpr (std::is_floating_point_v<T>) { ^ Multiple libraries were found for "WiFiClientSecure.h" Used: /home/builder/.arduino15/packages/arduino/hardware/esp32/2.0.11/libraries/WiFiClientSecure Not used: /home/builder/opt/libraries/seeed_arduino_rpcwifi_1_0_6 Multiple libraries were found for "Servo.h" Used: /home/builder/opt/libraries/servoesp32_1_1_1 Not used: /home/builder/opt/libraries/servo_1_2_1 Not used: /home/builder/opt/libraries/microbitv2_hhs_0_1_6 Not used: /home/builder/opt/libraries/xmc_servo_1_0_1 Not used: /home/builder/opt/libraries/rokitsmart_1_0_9 Not used: /home/builder/opt/libraries/printoo_library_1_0_2 Not used: /home/builder/opt/libraries/esp32_esp32s2_analogwrite_5_0_2 Not used: /home/builder/opt/libraries/evive_2_0_3 Multiple libraries were found for "WiFi.h" Used: /home/builder/.arduino15/packages/arduino/hardware/esp32/2.0.11/libraries/WiFi Not used: /home/builder/opt/libraries/nina_wi_fi_1_0_0 Not used: /home/builder/opt/libraries/indhilib_3_0_5 Not used: /home/builder/opt/libraries/vega_wifinina_1_0_1 Not used: /home/builder/opt/libraries/da16200_wi_fi_library_for_arduino_1_1_0 Not used: /home/builder/opt/libraries/wifiespat_1_4_3 Not used: /home/builder/opt/libraries/wifi_1_2_7 Not used: /home/builder/opt/libraries/seeed_arduino_rpcwifi_1_0_6 Not used: /home/builder/opt/libraries/wifinina_1_8_14 Error during build: exit status 1