Stuck on adaption of elapsedMillis

I’m trying to use elapsedMillis as part of a countdown that blinks an LED, plays a buzzer a number of times. I initially had problems when compiling with an error asking for the libraries which I think I have resolved by following another thread. However, with the elapsedMillis.h now included in the project folder I’m getting a number of compiler errors - millis was not declared, micros was not declared etc. in elapsedMillis. I’m also getting a expected declaration before } token, which I’m pretty sure is something to do with me getting out of my beginner depth!

Any help gratefully received.

#include <elapsedMillis.h>

///////// VARIABLES
const int countDownLed = D7;              // Set the countdown LED to pin D7
const int beeper = D0;                    // Set the beeper pin to D0 - //NOTE Tones only work on certain pins
const int pushButton = D2;                // Set the push button to D2
int pushButtonState = LOW;                // Sets pushbutton state variable
int countDownLedState = LOW;              // Sets LED state variable
int countDownState = 0;
int beeperState = LOW;                    // Sets beeper state variable

////////// TIMING
unsigned long previousMillis = 0;         // Set variable for time check in countdown
unsigned long previousMillisButton = 0;   // Set variable for time check in button press check
const long buttonInterval = 500;          // Button press check interval
const long interval = 300;                // Countdown LED/Beeper interval

////////// BEEPER
int countdownToneLength = 100;            // Insert length of countdown beep
int countdownTonePitch = 3000;            // Tone/frequency of countdown beep

///////// SET-UP
void setup() {

  // set modes for each pin used
  pinMode(countDownLed, OUTPUT);
  pinMode(beeper, OUTPUT);
  pinMode(pushButton, INPUT);

  // Set pins to LOW before starting
  digitalWrite(beeper, LOW);
  digitalWrite(countDownLed, LOW);

  // Defines a function to be sent to by Raspberry Pi


////////// LOOP
void loop()
  // Continually check for a button press

// Check for commands coming in for the Particle.function countdown
int countdownToggle(String command) {

    if (command=="on") {
        //digitalWrite(countDownLed, HIGH);
        countDownState = 1;
        return 1;                               // Returns status
    else if (command=="off") {
        countDownState = 0;
        return 0;
    else {
        return -1;

////////// COUNTDOWN
void countDown()
    unsigned long currentMillis = millis();

    while(countDownState == 1)
        for (int i = 1; i <= 20; i++)
                if (currentMillis - previousMillis >= interval) {
                // save the last time
                previousMillis = currentMillis;
                // if the LED/beeper is off turn it on and vice-versa:
                    if (countDownLedState == LOW)  {
                       countDownLedState = HIGH;
                       beeperState = HIGH;
                    } else {
                       countDownLedState = LOW;
                       beeperState = LOW;
                // set the LED state to the pin:
                digitalWrite(countDownLed, countDownLedState);
                        if (beeperState = HIGH) {
                        // Send the tone to the beeper pin
                        tone(beeper, countdownTonePitch, countdownToneLength);


////////// CHECK BUTTON
void checkButtonPress() {

    unsigned long currentMillisButton = millis();

    if (currentMillisButton - previousMillisButton >= buttonInterval) {
    previousMillisButton = currentMillisButton;
    pushButtonState = digitalRead(pushButton);
      if (pushButtonState == HIGH) {
        Particle.publish("buttonPressed", "HIGH");        // Send HIGH to Particle Dashboard if button is pressed
        pushButtonState == LOW;

When a source file has a .cpp filename extension, you must #include “application.h” or #include “Particle.h” at the top of the file to get the base data types and built-in functions like millis(), micros(), etc… This isn’t necessary for sketches using *.ino files because it’s automatically inserted for you by the wiring pre-processor.

Rick, thanks for the reply.
I don’t think I have any file with a cpp. extension.
In the project folder I have the .ino and elapsedMillis.h
Have included a screenshot that might help.

Oddly, you need to insert a comment before the first include line. It’s explained here:

Thank you so much. That’s the compile issue sorted.
I did read the link you sent me before posting but got a bit lost reading lots of different posts, trying to work this out.
Any thoughts on the expected declaration would be welcome but I’ll keep trying.

I’ve resolved the expected declaration but there’s something in the actual code that’s wrong as the LED lights, beeps but then the light stays on… things seem to be stuck somewhere.