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

guys, I need your help with my code if I miss anything
this is the error
[Error compiling for board NodeMCU 1.0 (ESP-12E Module]

#define BLYNK_PRINT Serial//// comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <SoftwareSerial.h>
#include <OneWire.h>
#include <DallasTemperature.h>
char auth[] = "1748acab0e3c4c7baca832f4a9d9e3fb";

/* Wifi credentials */
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ZONG MBB-E8231-6E63";
char pass[] = "electroniclinic";


SimpleTimer Timer;

#define ONE_WIRE_BUS 2 // DS18B20 on Arduino pin2 corresponds to D4 on physical board “D4 pin on the nodemcu Module”
OneWire oneWire (ONE_WIRE_BUS);
DallasTemperature DS18B20 (&oneWire);
float temp;
float Fahrenheit=0;
void setup ()
{
  Serial.begin (115200);
  Blynk.begin (auth, ssid, pass);
  DS18B20.begin ();
  Timer.setInterval (1000L, getSendData);
  Serial.println();
}
void loop ()
{
  Timer.run (); // Initiates SimpleTimer
  Blynk.run (); 
}
/**************************************************************************
*Send sensor data to Blynk
**************************************************************************/
void getSendData ()
{
  //DS18B20.requestTemperature ();
  float temp = DS18B20.getTempCByIndex (0); //Celcius
  float Fahrenheit = DS18B20.toFahrenheit (temp); //Fahrenheit
  Serial.println (temp);
  Serial.println (Fahrenheit);
  Blynk.virtualWrite (V3, temp); //virtual pin V3
  Blynk.virtualWrite (V4, Fahrenheit); //virtual pin V4
}

If the error is complaining about a timer, remove the #include <SimpleTimer.h> line.

Blynk now has the Timer() function in the Blynk library and that creates a conflict.

Joe Nelis

this is the error
[Error compiling for board NodeMCU 1.0 (ESP-12E Module]

guys, I need your help with my code if I miss anything
this is the error
[Error compiling for board NodeMCU 1.0 (ESP-12E Module]

#define BLYNK_PRINT Serial//// comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <SoftwareSerial.h>
#include <OneWire.h>
#include <DallasTemperature.h>
char auth[] = "1748acab0e3c4c7baca832f4a9d9e3fb";

/* Wifi credentials */
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ZONG MBB-E8231-6E63";
char pass[] = "electroniclinic";


SimpleTimer Timer;

#define ONE_WIRE_BUS 2 // DS18B20 on Arduino pin2 corresponds to D4 on physical board “D4 pin on the nodemcu Module”
OneWire oneWire (ONE_WIRE_BUS);
DallasTemperature DS18B20 (&oneWire);
float temp;
float Fahrenheit=0;
void setup ()
{
  Serial.begin (115200);
  Blynk.begin (auth, ssid, pass);
  DS18B20.begin ();
  Timer.setInterval (1000L, getSendData);
  Serial.println();
}
void loop ()
{
  Timer.run (); // Initiates SimpleTimer
  Blynk.run (); 
}
/**************************************************************************
*Send sensor data to Blynk
**************************************************************************/
void getSendData ()
{
  //DS18B20.requestTemperature ();
  float temp = DS18B20.getTempCByIndex (0); //Celcius
  float Fahrenheit = DS18B20.toFahrenheit (temp); //Fahrenheit
  Serial.println (temp);
  Serial.println (Fahrenheit);
  Blynk.virtualWrite (V3, temp); //virtual pin V3
  Blynk.virtualWrite (V4, Fahrenheit); //virtual pin V4
}

@mr.fsool please don’t spam the forum with multiple posts on the same subjects, otherwise your account will be suspended.
I’ve merged your last two topics together.

Pete.

sorry by mistake

Reboot your computer and if that doesn’t work then turn on verbose compilation messages in the Arduino IDE (File > Preferences) and recompile.

Pete.

Triple backticks look like this ( ``` )

I apologise John
I just could not figure that out but now have it

Pete,
Please assist if you can.

Board: "NodeMCU 1.0 (ESP-12E Module)
Port 3 connected.
#define USE_NODE_MCU_BOARD un-commented in code
DHT11 connected correctly - I believe - Not that I think this is relevant

Error:
Arduino: 1.8.19 (Windows 10), Board: “NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200”
In file included from C:\Data\Dropbox\Arduino\Paul McWhorter\libraries\DHT_sensor_library-1.4.3\DHT_U.cpp:15:
C:\Data\Dropbox\Arduino\Paul McWhorter\libraries\DHT_sensor_library-1.4.3\DHT_U.h:36:10: fatal error: Adafruit_Sensor.h: No such file or directory
36 | #include <Adafruit_Sensor.h>
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

// Fill-in information from your Blynk Template here
#define BLYNK_TEMPLATE_ID “TMPLwRpGCxLt”
#define BLYNK_DEVICE_NAME “NodeMCU”

#define BLYNK_FIRMWARE_VERSION “0.1.0”
#define BLYNK_PRINT Serial

#define USE_NODE_MCU_BOARD
#include “BlynkEdgent.h”
#include “DHT.h”
#define DHTPIN D2
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);
float t, h;

void sendSensor()
{
h = dht.readHumidity();
t = dht.readTemperature();
Blynk.virtualWrite(V0, h);
Blynk.virtualWrite(V1, t);
}

void setup()
{
Serial.begin(9600);
dht.begin();
BlynkEdgent.begin();
delay(2000);
timer.setInterval(1000L, sendSensor);
}

void loop()
{
BlynkEdgent.run();
timer.run(); // Initiates SimpleTimer
}

Should be

#include <DHT.h>

Thank John,
I will probably feel a bit foolish if this was a simple syntax problem.

When must it be " and when <

I changed the " to < and now have this error

Arduino: 1.8.19 (Windows 10), Board: “NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200”
In file included from C:\Data\Dropbox\Arduino\Paul McWhorter\libraries\DHT_sensor_library-1.4.3\DHT_U.cpp:15:
C:\Data\Dropbox\Arduino\Paul McWhorter\libraries\DHT_sensor_library-1.4.3\DHT_U.h:36:10: fatal error: Adafruit_Sensor.h: No such file or directory
36 | #include <Adafruit_Sensor.h>
compilation terminated.
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

It’s telling you that it can’t find the Adafruit DHT library.
Do you have it installed, and if so where?

Pete.

Hi Pete,

DHT_sensor_library-1.4.3 installed in 2 folders

C:\Users\ABCD\AppData\Local\Arduino15\staging\libraries
as well as
C:\Data\Dropbox\Arduino\Paul McWhorter\libraries

because I still have not figured out which folder is the correct and default one to use

By default the Sketchbook is located in these directories:

Windows: C:\Users{username}\Documents\Arduino\libraries
macOS: /Users/{username}/Documents/Arduino/libraries

In the IDE go to File > Preferences. Your sketch folder is the place where the IDE will expect libraries to be, under /libraries.

If you use the IDE Library manager to do the install of the Adafruit DHT library then it will put it in the correct location, and prompt you for any additional helper libraries that are required (which is common with the Adafruit stuff).

Pete.

Pete,
I seem to have gotten myself in to a real mess as to where the libraries are to be located

I am no being confronted with this error message.

Please help - I am just not getting this entire thing right with one step forward and 2 steps back.

Arduino: 1.8.19 (Windows 10), Board: “NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200”

Executable segment sizes:

ICACHE : 32768 - flash instruction cache

IROM : 422816 - code in flash (default or ICACHE_FLASH_ATTR)

IRAM : 29797 / 32768 - code in IRAM (IRAM_ATTR, ISRs…)

DATA : 1624 ) - initialized variables (global, static) in RAM/HEAP

RODATA : 6124 ) / 81920 - constants (global, static) in RAM/HEAP

BSS : 27704 ) - zeroed variables (global, static) in RAM/HEAP

Sketch uses 460361 bytes (44%) of program storage space. Maximum is 1044464 bytes.

Global variables use 35452 bytes (43%) of dynamic memory, leaving 46468 bytes for local variables. Maximum is 81920 bytes.

esptool.py v3.0

Serial port COM3

Connecting…

Chip is ESP8266EX

Features: WiFi

Crystal is 26MHz

MAC: e8:68:e7:ce:2e:d1

Uploading stub…

Running stub…

Stub running…

Configuring flash size…

Traceback (most recent call last):

File “C:\Users\ABCD\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2/tools/upload.py”, line 66, in

esptool.main(cmdline)

File “C:/Users/ABCD/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\esptool.py”, line 3599, in main

detect_flash_size(esp, args)

File “C:/Users/ABCD/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\esptool.py”, line 2848, in detect_flash_size

flash_id = esp.flash_id()

File “C:/Users/ABCD/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\esptool.py”, line 688, in flash_id

return self.run_spiflash_command(SPIFLASH_RDID, b"", 24)

File “C:/Users/ABCD/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\esptool.py”, line 948, in run_spiflash_command

old_spi_usr = self.read_reg(SPI_USR_REG)

File “C:/Users/ABCD/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\esptool.py”, line 562, in read_reg

val, data = self.command(self.ESP_READ_REG, struct.pack('<I', addr))

File “C:/Users/ABCD/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\esptool.py”, line 386, in command

p = self.read()

File “C:/Users/ABCD/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\esptool.py”, line 331, in read

return next(self._slip_reader)

File “C:/Users/ABCD/AppData/Local/Arduino15/packages/esp8266/hardware/esp8266/3.0.2/tools/esptool\esptool.py”, line 2636, in slip_reader

raise FatalError("Timed out waiting for packet %s" % waiting_for)

esptool.FatalError: Timed out waiting for packet header

esptool.FatalError: Timed out waiting for packet header

Invalid library found in C:\Data\Dropbox\Arduino\libraries\libraries: no headers files (.h) found in C:\Data\Dropbox\Arduino\libraries\libraries

This report would have more information with
“Show verbose output during compilation”
option enabled in File → Preferences.

This isn’t a Blynk issue at all, so this is the wrong place to be asking these questions, especially as you seem reluctant to share any info about how you’ve configured your IDE settings, or how you’ve installed your libraries.

Maybe an Arduino IDE forum would be the best place to find help.

As always, we are happy to help with Blynk related issues.

Pete.

Hi Pete,
I am not reluctant at all to share any of my installation details - I just don’t want to clog up your page.

I have re-installed Arduino IDE , sorted out the library folders with the default folder being
C:\Data\Dropbox\Arduino\Libraries
Notwithstanding this default, the libraries, which I install with the library manager of Arduino IDE also get installed in
C:\Users\ABCD\AppData\Local\Arduino15\staging\libraries

And now I get this error:
Arduino: 1.8.19 (Windows 10), Board: “NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible), 32KB cache + 32KB IRAM (balanced), Use pgm_read macros for IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200”
C:\Users\ABCD\AppData\Local\Temp\arduino_modified_sketch_856018\NodeMCU_LM35DZ_LED_Blynk_ESP8266.ino: In function ‘void loop()’:
NodeMCU_LM35DZ_LED_Blynk_ESP8266:83:3: error: ‘timer’ was not declared in this scope; did you mean ‘Timer’?
83 | timer.run(); // Initiates SimpleTimer
| ^~~~~
| Timer
exit status 1

‘timer’ was not declared in this scope; did you mean ‘Timer’?

/*
   https://www.youtube.com/watch?v=_kywwUFH3Pc
   https://github.com/binaryupdates/Blynk-Sensor-Monitoring-NodeMCU

*/
// Fill-in information from your Blynk Template here
#define BLYNK_TEMPLATE_ID "TMPLwRpGCxLt"
#define BLYNK_DEVICE_NAME "NodeMCU"

#define BLYNK_FIRMWARE_VERSION        "0.1.0"

#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG

#define APP_DEBUG

// Uncomment your board, or configure a custom board in Settings.h
//#define USE_SPARKFUN_BLYNK_BOARD
//#define USE_NODE_MCU_BOARD
//#define USE_WITTY_CLOUD_BOARD
//#define USE_WEMOS_D1_MINI

#include "BlynkEdgent.h"
//=================================
#include <DHT.h>
#define DHTPIN D2 
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);
float t, h;

void sendSensor()
{
  h = dht.readHumidity();
  t = dht.readTemperature();  
  Blynk.virtualWrite(V0, h);
  Blynk.virtualWrite(V1, t);
}
//=================================

int temp;

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

BLYNK_CONNECTED()
{
  Blynk.syncVirtual(V0);
  Blynk.virtualWrite(V1, temp);
}

void setup()
{
  pinMode(2, OUTPUT); // Initialise digital pin 2 as an output pin
  Serial.begin(115200);
  delay(100);

  BlynkEdgent.begin();

//=====================================
  delay(500); 
  dht.begin();
delay(500); 

  Timer.setInterval(1000L, sendSensor); 
//=====================================

  
}

void loop() {
  //temp= analogRead(A0);
  //Serial.println(temp);
  temp = (analogRead(A0) * (3.3 / 1023) * 1000);
  BlynkEdgent.run();
  timer.run(); // Initiates SimpleTimer
}

You should add a timer object

BlynkTimer timer;
1 Like