Error compiling for board NodeMCU 1.0 (ESP-12E Module)

can any 1 tell me what i did wrong for this advanced timer input for nodemcu module


/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

BLYNK_WRITE(V1) {
  TimeInputParam t(param);

  // Process start time

  if (t.hasStartTime())
  {
    Serial.println(String("Start: ") +
                   t.getStartHour() + ":" +
                   t.getStartMinute() + ":" +
                   t.getStartSecond());
  }
  else if (t.isStartSunrise())
  {
    Serial.println("Start at sunrise");
  }
  else if (t.isStartSunset())
  {
    Serial.println("Start at sunset");
  }
  else
  {
    // Do nothing
  }

  // Process stop time

  if (t.hasStopTime())
  {
    Serial.println(String("Stop: ") +
                   t.getStopHour() + ":" +
                   t.getStopMinute() + ":" +
                   t.getStopSecond());
  }
  else if (t.isStopSunrise())
  {
    Serial.println("Stop at sunrise");
  }
  else if (t.isStopSunset())
  {
    Serial.println("Stop at sunset");
  }
  else
  {
    // Do nothing: no stop time was set
  }

  // Process timezone
  // Timezone is already added to start/stop time

  Serial.println(String("Time zone: ") + t.getTZ());

  // Get timezone offset (in seconds)
  Serial.println(String("Time zone offset: ") + t.getTZ_Offset());

  // Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)

  for (int i = 1; i <= 7; i++) {
    if (t.isWeekdaySelected(i)) {
      Serial.println(String("Day ") + i + " is selected");
    }
  }

  Serial.println();
  if (param.asInt() == 1) {
  digitalWrite(2, HIGH);
  }
  else {
    digitalWrite(2, LOW);
  }
}

void setup()
{
  // Debug console
  Serial.begin(9600);
pinMode(2, OUTPUT);
  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
}

void loop()
{
  Blynk.run();
}

What is the exact error?

It shows error compiling for board nodemcu 1.0(esp-12e module).I think I would have missed some header file…I don’t know where the error is but it shows error compiling for board nodemcu 1.0(esp-12e module).

Well, that tells us that it is throwing some form of an error when uploading to that board… now can you redo it and show us the actual error? :stuck_out_tongue_winking_eye:

1 Like


now,after combining both BLYNK_WRITE(V1) ,there is no error …see,i have edited my code in the first post.
i was not able to control my desired pin in the nodemcu using blynk timer,there no output at the pin even after the start time,but when to tried to switch on the pin by button it is working,can any 1 help me??

Whatever it is you are trying to do… you appear to be misunderstanding how Blynk works. You seem have everything crammed into a single Blynk function that runs whenever you press a button.

I suggest you start with some of that basic Examples Sketches and first learn the basics.

2 Likes

thanks @Gunner …!
i tried to upload this code

#define BLYNK_PRINT Serial


#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "YourNetworkName";
char pass[] = "YourPassword";

BLYNK_WRITE(V1) {
  TimeInputParam t(param);

  // Process start time

  if (t.hasStartTime())
  {
    Serial.println(String("Start: ") +
                   t.getStartHour() + ":" +
                   t.getStartMinute() + ":" +
                   t.getStartSecond());
  }
  else if (t.isStartSunrise())
  {
    Serial.println("Start at sunrise");
  }
  else if (t.isStartSunset())
  {
    Serial.println("Start at sunset");
  }
  else
  {
    // Do nothing
  }

  // Process stop time

  if (t.hasStopTime())
  {
    Serial.println(String("Stop: ") +
                   t.getStopHour() + ":" +
                   t.getStopMinute() + ":" +
                   t.getStopSecond());
  }
  else if (t.isStopSunrise())
  {
    Serial.println("Stop at sunrise");
  }
  else if (t.isStopSunset())
  {
    Serial.println("Stop at sunset");
  }
  else
  {
    // Do nothing: no stop time was set
  }

  // Process timezone
  // Timezone is already added to start/stop time

  Serial.println(String("Time zone: ") + t.getTZ());

  // Get timezone offset (in seconds)
  Serial.println(String("Time zone offset: ") + t.getTZ_Offset());

  // Process weekdays (1. Mon, 2. Tue, 3. Wed, ...)

  for (int i = 1; i <= 7; i++) {
    if (t.isWeekdaySelected(i)) {
      Serial.println(String("Day ") + i + " is selected");
    }
  }

  Serial.println();
}

BLYNK_WRITE(V1)
{
if (param.asInt() == 1) {
  digitalWrite(2, HIGH);
  }
  else {
    digitalWrite(2, LOW);
  }
}
void setup()
{
  // Debug console
  Serial.begin(9600);
  pinMode(2, OUTPUT);
  Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8442);
}

void loop()
{
  Blynk.run();
}

but it shows…


i just wanted to control my nodemcu gpio pin by timer widget…
thanks for helping.!

You can make life easier for us all by simply cutting and pasting the compiler messages but ensure you use formatting tags.

Arduino: 1.8.5 (Windows 8.1), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"

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

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

                 from C:\Users\bpkma_000\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp8266.h:18,

                 from C:\Users\bpkma_000\Documents\Arduino\timer6\timer6.ino:30:

C:\Users\bpkma_000\Documents\Arduino\timer6\timer6.ino: In function 'void BlynkWidgetWrite1(BlynkReq&, const BlynkParam&)':

C:\Users\bpkma_000\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkHandlers.h:152:10: error: redefinition of 'void BlynkWidgetWrite1(BlynkReq&, const BlynkParam&)'

     void BlynkWidgetWrite ## pin (BlynkReq BLYNK_UNUSED &request, const BlynkParam BLYNK_UNUSED &param)

          ^

C:\Users\bpkma_000\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkHandlers.h:160:31: note: in expansion of macro 'BLYNK_WRITE_2'

 #define BLYNK_WRITE(pin)      BLYNK_WRITE_2(pin)

                               ^

C:\Users\bpkma_000\Documents\Arduino\timer6\timer6.ino:119:1: note: in expansion of macro 'BLYNK_WRITE'

 BLYNK_WRITE(V1)

 ^

C:\Users\bpkma_000\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkHandlers.h:152:10: error: 'void BlynkWidgetWrite1(BlynkReq&, const BlynkParam&)' previously defined here

     void BlynkWidgetWrite ## pin (BlynkReq BLYNK_UNUSED &request, const BlynkParam BLYNK_UNUSED &param)

          ^

C:\Users\bpkma_000\Documents\Arduino\libraries\Blynk\src/Blynk/BlynkHandlers.h:160:31: note: in expansion of macro 'BLYNK_WRITE_2'

 #define BLYNK_WRITE(pin)      BLYNK_WRITE_2(pin)

                               ^

C:\Users\bpkma_000\Documents\Arduino\timer6\timer6.ino:41:1: note: in expansion of macro 'BLYNK_WRITE'

 BLYNK_WRITE(V1) {

 ^

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.

above thing is the
error message

I have checked this example, it really does not compile.

I see two BLYNK_WRITE(V1)commands. This may be the issue.

2 Likes

Well this is an issue for sure. I’ve just copied the code as I thought it was the same as advanced time input example, I overlooked double V1.

Edit: @sathya just change one of the virtual pins to V0 or V2. It compiles well.

1 Like

Why not just use the basic timer widget?

http://docs.blynk.cc/#widgets-controllers-timer

Or if using an android the Eventor Widget, as it has slightly more advanced timer options (days and such)?

http://docs.blynk.cc/#widgets-other-eventor

1 Like

Yes… I sometimes get this or other generic errors when I mistakenly double up on a BLYNK_WRITE(Vx)

Deciphering errors is part science, part art, and all effort :stuck_out_tongue:

1 Like

:heart_decoration::heart_decoration:thank you guys

Programmer problems…

3 Likes