PlatformIO Community

Expected initializer before '


#1

Hello
i try to comple a sample-code at the timealarms lib.

if i declare the function

void printDigits(int digits) {
  Serial.print(":");
  if (digits < 10)
    Serial.print('0');
  Serial.print(digits);
}

at the top with

void printDigits(int digits) ;

thats ok… but if i declare this function

void digitalClockDisplay() {
  // digital clock display of the time
  Serial.print(hour());
  printDigits(minute());
  printDigits(second());
  Serial.println();
}

with void digitalClockDisplay() ;

then i get an error too

i get some errors like that

src\main.cpp:72:23: error: 'OnceOnly' was not declared in this scope
Alarm.timerOnce(10, OnceOnly);            // called once after 10 seconds
^
src\main.cpp:50:5: warning: unused variable 'stunden' [-Wunused-variable]

int stunden   = hour();
^

i get also an error
with
AlarmId id;
with error-message

src\main.cpp:30:1: error: expected initializer before 'AlarmId'
AlarmId id;
^

What am I doing wrong?

Best regards
Achim


#2

Your error does not seem related to the printDigits and digitalClockDisplay() functions at all, you’re calling Alarm.timerOnce(10, OnceOnly); and it can’t find the OnceOnly function. Where is located?