arduino icon indicating copy to clipboard operation
arduino copied to clipboard

Missing code?

Open arpruss opened this issue 8 years ago • 5 comments

When I try to build this project, I get a lot of messages about undefined stuff:

C:\Users\Alexander\Documents\Arduino\esp8266-ledclock\esp8266-ledclock.ino: In function 'void handleRoot()':

esp8266-ledclock:32: error: 'hour' was not declared in this scope

s.replace("@@HOUR@@", String(hour()));

                                 ^

esp8266-ledclock:33: error: 'minute' was not declared in this scope

s.replace("@@MIN@@", String(minute()));

                                  ^

esp8266-ledclock:36: error: 'timeStatus' was not declared in this scope

s.replace("@@SYNCSTATUS@@", timeStatus() == timeSet ? "OK" : "Overdue");

                                      ^

esp8266-ledclock:36: error: 'timeSet' was not declared in this scope

s.replace("@@SYNCSTATUS@@", timeStatus() == timeSet ? "OK" : "Overdue");

                                           ^

C:\Users\Alexander\Documents\Arduino\esp8266-ledclock\esp8266-ledclock.ino: In function 'void handleForm()':

esp8266-ledclock:59: error: 'getNtpTime' was not declared in this scope

time_t newTime = getNtpTime();

                           ^

esp8266-ledclock:61: error: 'setTime' was not declared in this scope

 setTime(newTime);

                ^

esp8266-ledclock:77: error: 'setupWiFi' was not declared in this scope

 setupWiFi();

           ^

C:\Users\Alexander\Documents\Arduino\esp8266-ledclock\esp8266-ledclock.ino: In function 'void setup()':

esp8266-ledclock:82: error: 'setupDisplay' was not declared in this scope

setupDisplay();

            ^

esp8266-ledclock:85: error: 'setupWiFi' was not declared in this scope

setupWiFi();

         ^

esp8266-ledclock:86: error: 'setupTime' was not declared in this scope

setupTime();

         ^

C:\Users\Alexander\Documents\Arduino\esp8266-ledclock\esp8266-ledclock.ino: In function 'void loop()':

esp8266-ledclock:94: error: 'displayIP' was not declared in this scope

if (displayIP()) return;

             ^

esp8266-ledclock:96: error: 'timeStatus' was not declared in this scope

 if (timeStatus() != timeNotSet) {

                ^

esp8266-ledclock:96: error: 'timeNotSet' was not declared in this scope

 if (timeStatus() != timeNotSet) {

                     ^

esp8266-ledclock:97: error: 'now' was not declared in this scope

   if (now() != prevDisplay) { //update the display only if time has changed

           ^

esp8266-ledclock:99: error: 'displayClock' was not declared in this scope

     displayClock();  

                  ^

C:\Users\Alexander\Documents\Arduino\esp8266-ledclock\esp8266-ledclock.ino: In function 'void setupWiFi()':

esp8266-ledclock:108: error: 'displayBusy' was not declared in this scope

displayBusy(0);

            ^

esp8266-ledclock:111: error: 'stopDisplayBusy' was not declared in this scope

   stopDisplayBusy();

                   ^

esp8266-ledclock:112: error: 'setupAP' was not declared in this scope

   return setupAP();

                  ^

esp8266-ledclock:112: error: return-statement with a value, in function returning 'void' [-fpermissive]

esp8266-ledclock:116: error: 'stopDisplayBusy' was not declared in this scope

stopDisplayBusy();

               ^

esp8266-ledclock:117: error: 'setupSTA' was not declared in this scope

setupSTA();

        ^

C:\Users\Alexander\Documents\Arduino\esp8266-ledclock\esp8266-ledclock.ino: In function 'void setupSTA()':

esp8266-ledclock:126: error: 'displayBusy' was not declared in this scope

displayBusy(1);

            ^

esp8266-ledclock:141: error: 'stopDisplayBusy' was not declared in this scope

stopDisplayBusy();

               ^

esp8266-ledclock:142: error: 'displayDash' was not declared in this scope

displayDash();

           ^

C:\Users\Alexander\Documents\Arduino\esp8266-ledclock\esp8266-ledclock.ino: In function 'void setupAP()':

esp8266-ledclock:149: error: 'displayAP' was not declared in this scope

displayAP();

         ^

C:\Users\Alexander\Documents\Arduino\esp8266-ledclock\display.ino: In function 'void displayBusy(char)':

display:103: error: '_displayBusy' was not declared in this scope

ticker.attach(0.1, _displayBusy);

                  ^

C:\Users\Alexander\Documents\Arduino\esp8266-ledclock\display.ino: In function 'char displayIP()':

display:130: error: '_displayIP' was not declared in this scope

ticker.attach(1.0, _displayIP);

                  ^

C:\Users\Alexander\Documents\Arduino\esp8266-ledclock\display.ino: In function 'void _displayIP()':

display:138: error: 'displayClock' was not declared in this scope

 clockMode == MODE_CLOCK ? displayClock() : displayAP();

                                        ^

C:\Users\Alexander\Documents\Arduino\esp8266-ledclock\display.ino: In function 'void displayClock()':

display:157: error: 'hour' was not declared in this scope

int h = hour();

            ^

display:158: error: 'minute' was not declared in this scope

int m = minute();

              ^

display:173: error: 'second' was not declared in this scope

if (second() & 0x1) decimals = 0x4;

          ^

display:174: error: 'timeStatus' was not declared in this scope

if (timeStatus() != timeSet) decimals |= 0x1;

              ^

display:174: error: 'timeSet' was not declared in this scope

if (timeStatus() != timeSet) decimals |= 0x1;

                   ^

C:\Users\Alexander\Documents\Arduino\esp8266-ledclock\ntp.ino: In function 'void setupTime()':

ntp:13: error: 'getNtpTime' was not declared in this scope

setSyncProvider(getNtpTime);

               ^

ntp:13: error: 'setSyncProvider' was not declared in this scope

setSyncProvider(getNtpTime);

                         ^

ntp:14: error: 'setSyncInterval' was not declared in this scope

setSyncInterval(settings.interval);

                                ^

C:\Users\Alexander\Documents\Arduino\esp8266-ledclock\ntp.ino: In function 'time_t getNtpTime()':

ntp:23: error: 'sendNTPpacket' was not declared in this scope

 sendNTPpacket(&udp);

                   ^

ntp:33: error: 'SECS_PER_HOUR' was not declared in this scope

      return secSince1900 - 2208988800UL + settings.timezone * SECS_PER_HOUR;

                                                               ^

exit status 1 'hour' was not declared in this scope

arpruss avatar Jun 01 '16 14:06 arpruss

A number of these were solved by downloading the Time library and adding an #include <TimeLib.h>. But some of the functions missing a declaration in the header file seemed to still be a problem.

arpruss avatar Jun 02 '16 04:06 arpruss

Code worked perfectly fine for me. Thank you, this is brilliant. Only thing extra I had to add was an include for TimeLib.h which is referenced by the new Time.h

MorningLightMountain713 avatar Sep 29 '16 05:09 MorningLightMountain713

Similar issue in ntp.ino

ServerProcessor avatar Dec 26 '16 08:12 ServerProcessor

Did anyone else besides megachips get this to work? I'm getting all the same errors as arpuss. I'm using arduino ide 1.6.11.

KickAss2k1 avatar Dec 29 '16 01:12 KickAss2k1

You need to download the Time library:

https://github.com/PaulStoffregen/Time

buxtronix avatar Feb 03 '17 02:02 buxtronix