BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Error compiling for board nodemcu1.0

I’m trying to upload this sketch to my esp8266, but the compiler shows this error:


In file included from C:\Users\mus76\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkApi.h:17:0,

                 from C:\Users\mus76\Documents\Arduino\libraries\Blynk\src/BlynkApiArduino.h:14,

                 from C:\Users\mus76\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266.h:24,

                 from C:\Users\mus76\Documents\Arduino\hc04_simpletimer\hc04_simpletimer.ino:2:

C:\Users\mus76\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkTimer.h:36:21: error: redefinition of 'class BlynkTimer'

 #define SimpleTimer BlynkTimer

                     ^

C:\Users\mus76\Documents\Arduino\libraries\SimpleTimer/SimpleTimer.h:10:7: note: in expansion of macro 'SimpleTimer'

 class SimpleTimer {

       ^

C:\Users\mus76\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkTimer.h:36:21: error: previous definition of 'class BlynkTimer'

 #define SimpleTimer BlynkTimer

                     ^

C:\Users\mus76\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkTimer.h:41:7: note: in expansion of macro 'SimpleTimer'

 class SimpleTimer {

       ^

exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

My sketch is here:

#include <ESP8266WiFi.h> 
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h> 
char auth[] = "YourAuthToken";  
// Your WiFi credentials.  
// Set password to "" for open networks.
char ssid[] = "Your SSID";
char pass[] = "Your password";  
#define ECHOPIN 12  //Echo to pin D6 
#define TRIGPIN 14   //Trig to pin D5   
unsigned long previousMillisA = 0;        
unsigned long previousMillisB = 0;   
const long intervalA = 2;  
const long intervalB = 10;  
const long intervalC = 1000; // cycle period SimpleTimer timer;  
WidgetLCD lcd(V2);
SimpleTimer timer;
  void setup()  { 
    Serial.begin(9600);      
    pinMode(ECHOPIN, INPUT);   
    pinMode(TRIGPIN, OUTPUT);  
    Blynk.begin(auth, ssid, pass);         
    timer.setInterval(1000L, sendUptime);    
    }  
    void sendUptime() {  
      unsigned long currentMillisA = millis();   
      unsigned long currentMillisB = millis();    
      if (currentMillisB - previousMillisB >= intervalC)
      { 
        previousMillisB = currentMillisB;// trebuie       
        if (currentMillisA - previousMillisA <= intervalA)
        {    
          previousMillisA = currentMillisA;      
          digitalWrite(TRIGPIN, LOW);    
          }     
          else {      
            digitalWrite(TRIGPIN, HIGH);     
            }   
            if (currentMillisA - previousMillisA >= intervalB) 
            {          digitalWrite(TRIGPIN, LOW);    
            }    
            float distance = pulseIn(ECHOPIN, HIGH);     
            distance= distance/50;    
            Serial.println(distance); 
            lcd.clear(); //Use it to clear the LCD Widget
            lcd.print(0, 0, distance);
             } 
            }   
            
            void loop() 
            {   
              Blynk.run(); // Initiates Blynk  
              timer.run(); // Initiates SimpleTimer    
            }

I’ve followed this post https://community.blynk.cc/t/error-compiling-for-board-nodemcu-1-0-esp-12e-module/24476, and updated my blynk libraries.
Same difference.
Thanks in advance.

Hi,
The error was fixed by cleaning up the simpleTimer library and downloading the official one from here:
https://github.com/jfturcot/SimpleTimer