Hello,
I went throught a problem when compiling a program for mkr wifi 1010, which I use with the arduino iot cloud. I can't get the current time on an ntp server with rtczero. Here is my code and the error I got:
#include "arduino_secrets.h"
// Servo - Version: Latest
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/99e3d278-26e1-4c41-a4f0-c9cb605305df
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
int heure;
int minute;
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>
#include <RTCZero.h>
const int GMT = 1;
const int myClock = 24;
int heureActuelle;
int minuteActuelle;
int angle = 90;
Servo droite;
Servo gauche;
RTCZero Myrtc;
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);
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
droite.attach(2);
gauche.attach(3);
droite.write(0);
gauche.write(0);
delay(10000);
Myrtc.begin();
// 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() {
heureActuelle = Myrtc.getHours() + GMT;
minuteActuelle = Myrtc.getMinutes();
ArduinoCloud.update();
if (heureActuelle == heure && minuteActuelle == minute) {
for (int i = 0 ; i <10 ; i++) {
droite.write(angle);
gauche.write(angle);
delay(500);
droite.write(0);
gauche.write(0);
delay(500);
}
}
}
/*
Since Heure is READ_WRITE variable, onHeureChange() is
executed every time a new value is received from IoT Cloud.
*/
void onHeureChange() {
// Add your code here to act upon Heure change
}
/*
Since Minute is READ_WRITE variable, onMinuteChange() is
executed every time a new value is received from IoT Cloud.
*/
void onMinuteChange() {
// Add your code here to act upon Minute change
}
Arduino : 1.8.15 (Windows 10), Carte : "Arduino MKR WiFi 1010"
libraries\ArduinoIoTCloud\utility\time\objs.a(TimeService.cpp.o):C:\Users\___\Documents\Arduino\libraries\ArduinoIoTCloud\src\utility\time/TimeService.cpp:33: multiple definition of ``rtc'
sketch\objs.a(Untitled_jul20c.ino.cpp.o):G:\Autres ordinateurs\Mon PC\Desktop\Projets\Pschit\Untitled_jul20c/Untitled_jul20c.ino:32: first defined here
collect2.exe: error: ld returned 1 exit status
Plusieurs bibliothèque trouvées pour "Servo.h"
Utilisé : C:\Users\___\Documents\Arduino\libraries\Servo
Non utilisé : C:\Program Files (x86)\Arduino\libraries\Servo
Plusieurs bibliothèque trouvées pour "Adafruit_SleepyDog.h"
Utilisé : C:\Users\___\Documents\Arduino\libraries\Adafruit_SleepyDog_Library
Non utilisé : C:\Users\___\Documents\Arduino\libraries\arduino_120846
exit status 1
Erreur de compilation pour la carte Arduino MKR WiFi 1010
Ce rapport pourrait être plus détaillé avec
l'option "Afficher les résultats détaillés de la compilation"
activée dans Fichier -> Préférences.