Hello everybody. I am new to arduino and have been trying to build a 3d printed LED clock and am using a sketch that was provided by the designer of the clock but I am running into errors in trying to upload the sketch. I have an arduino mini esp 32. I am getting a lot of errors with the time library and I am unable to figure out what I am doing wrong. If anybody can help me and look at the sketch and tell me what I am not doing correctly I would be very appreciative
Hi @joeyjojojrshabadoo. I'm going to ask you to provide some additional information that might help us to identify the problem.
This procedure is not intended to solve the problem. The purpose is to gather more information.
Please do this:
When you encounter an error, there should be an error notification at the bottom right corner of the Arduino IDE window. Click the "COPY ERROR MESSAGES" button on that notification.
Open a reply here on this forum topic by clicking the "Reply" button.
Click the <CODE/> icon on the post composer toolbar.
This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
This will paste the copied output into the code block.
Move the cursor outside of the code block before you add any additional text to your reply.
Click the "Reply" button to publish the post.
In case the output is longer than the forum software will allow to be added to a post, you can instead save it to a .txt file and then attach that file to a reply here.
Select the .txt file you saved from the "Open" dialog.
Click the "Open" button.
The dialog will close.
Click the "Reply" button to publish the post.
Alternatively, instead of using the "Upload" icon on the post composer toolbar as described in steps (5) - (7) above, you can simply drag and drop the .txt file onto the post composer field to attach it.
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:15:30: error: 'tmtime' declared as reference but not initialized
struct getLocalTime(&tmtime);
^
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino: In function 'void setup()':
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:48:3: error: 'WiFi' was not declared in this scope
WiFi.mode(WIFI_STA);
^~~~
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:48:13: error: 'WIFI_STA' was not declared in this scope
WiFi.mode(WIFI_STA);
^~~~~~~~
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:53:27: error: 'WL_CONNECTED' was not declared in this scope
while (WiFi.status() != WL_CONNECTED) {
^~~~~~~~~~~~
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:53:27: note: suggested alternative: 'FL_DEPRECATED'
while (WiFi.status() != WL_CONNECTED) {
^~~~~~~~~~~~
FL_DEPRECATED
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:56:3: error: 'configTime' was not declared in this scope
configTime(TIMEZONE * 3600L, 0, "pool.ntp.org", "time.nis.gov");
^~~~~~~~~~
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino: In function 'void loop()':
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:74:23: error: 'tmtime' declared as reference but not initialized
getLocalTime(&tmtime);
^
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:75:9: error: invalid use of incomplete type 'struct getLocalTime'
hh = &tmtime.tm_hour;
^~~~~~
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:15:10: note: forward declaration of 'struct getLocalTime'
struct getLocalTime(&tmtime);
^~~~~~~~~~~~
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:75:9: error: invalid use of incomplete type 'struct getLocalTime'
hh = &tmtime.tm_hour;
^~~~~~
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:15:10: note: forward declaration of 'struct getLocalTime'
struct getLocalTime(&tmtime);
^~~~~~~~~~~~
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:76:10: error: invalid use of incomplete type 'struct getLocalTime'
mmm = &tmtime.tm_min;
^~~~~~
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:15:10: note: forward declaration of 'struct getLocalTime'
struct getLocalTime(&tmtime);
^~~~~~~~~~~~
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:76:10: error: invalid use of incomplete type 'struct getLocalTime'
mmm = &tmtime.tm_min;
^~~~~~
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:15:10: note: forward declaration of 'struct getLocalTime'
struct getLocalTime(&tmtime);
^~~~~~~~~~~~
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:77:9: error: invalid use of incomplete type 'struct getLocalTime'
ss = &tmtime.tm_sec;
^~~~~~
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:15:10: note: forward declaration of 'struct getLocalTime'
struct getLocalTime(&tmtime);
^~~~~~~~~~~~
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:77:9: error: invalid use of incomplete type 'struct getLocalTime'
ss = &tmtime.tm_sec;
^~~~~~
C:\Users\parin\OneDrive\Desktop\LED_Ring_V01\LED_Ring_V01.ino:15:10: note: forward declaration of 'struct getLocalTime'
struct getLocalTime(&tmtime);
^~~~~~~~~~~~
exit status 1
Compilation error: 'tmtime' declared as reference but not initialized
I agree with @sonofcy that it appears you may have either not copied the entirety of the sketch code provided by the clock designer, or perhaps you later broke the code by modifying it.
So go back and get a fresh copy of the original sketch. Hopefully that will solve the problem. If you still have problems, let us know and we'll provide further assistance.
First one you should ask is the designer of the clock.
When you seek for help here, please post ALL information you got. A link to the project, a description of that project and if nothing is online - at least a picture of your project so we can see what you have got.
What exactly is that. There are many different ESP32 boards.
The code seems outdated.
Most ESP32 boards don't need a time library, because it's already included in the latest core.
NTP for an ESP32 can be done with a single line of code in setup(). See this example sketch.
Post#16 there includes code to wait for a valid NTP update.
Leo..