-->
Page 1 of 1

Sketch that compiles OK for Arduino, doesn't for NodeMCU 1.0

PostPosted: Mon Jan 30, 2017 8:03 am
by Ramv
Sketch that compiles OK for Arduino, doesn't for NodeMCU 1.0 (ESP-12E) V3 (LoLin) Module

Setup details
Arduino IDE (version 1.8.2), Running on a Raspberry Pi 3
(Rpi OS: "Raspbian GNU/Linux", VERSION="8 (jessie)", Debian)

NodeMCU (ESP_12E) V3 (LoLin) Module connected to Raspberry Pi USB Port

DHT22 and a 20x4 LCD I2C Display connected to NodeMCU Module
NodeMCU Conections data:

DHT and LCD Display Pins connections to Node MCU Pins
------------------------------------------------------------------------------------
DHT22 and LCD Display “VCC” Pins to VU
DHT22 “Data” Pin to D4 (GPIO2)
DHT22 and LCD Display “GND” Pins to G
LCD Display “SCL” Pin to D1
LCD Display “SDA” Pin to D2


Error Message while Compiling Sketch for NodeMCU 1.0 (ESP-12E) V3 (LoLin) Module
Arduino: 1.8.2 Hourly Build 2017/01/20 06:19 (Linux), Board: "NodeMCU 1.0 (ESP-12E Module), 160 MHz, 115200, 4M (3M SPIFFS)"

Build options changed, rebuilding all
In file included from /home/pi/Arduino/libraries/DHT/dht.h:18:0,
from /home/pi/Arduino/libraries/DHT/dht.cpp:30:
/home/pi/Arduino/libraries/DHT/dht.cpp: In member function 'int dht::_readSensor(uint8_t, uint8_t)':
/home/pi/.arduino15/packages/esp8266/hardware/esp8266/2.3.0/cores/esp8266/Arduino.h:226:63: error: cannot convert 'volatile uint32_t* {aka volatile unsigned int*}' to 'volatile uint8_t* {aka volatile unsigned char*}' in initialization
#define portInputRegister(port) ((volatile uint32_t*) &GPI)
^
/home/pi/Arduino/libraries/DHT/dht.cpp:116:29: note: in expansion of macro 'portInputRegister'
volatile uint8_t *PIR = portInputRegister(port);
^
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.

(Error Message with showing Verbose Output, and the Sketch used are attached)
(However, I did find other functions to have the NodeMCU Module to Read Humidity and Temp. data using DHT22 work satisfactorily.)

Re: Sketch that compiles OK for Arduino, doesn't for NodeMCU

PostPosted: Tue Jan 31, 2017 10:50 am
by Ramv
I tested the Sketch with a NodeMCU Version 0.9 (ESP-12) Module also, and I have the same problem.
(My initial post/Report was for a test with Version 1.0 LoLin V3 Module)

Re: Sketch that compiles OK for Arduino, doesn't for NodeMCU

PostPosted: Tue Jan 31, 2017 7:45 pm
by gdsports
The DHT library has code specific to AVR CPUs so will not work on the ESP8266. Update the DHT library to the latest version or try a different DHT library that is designed to work on the ESP8266.