Example sketches for the new Arduino IDE for ESP8266

Moderator: igrr

User avatar
By Stefan73
#18388 The DHT lib is the standard one which you can also download from within the IDE.

library.properties states:
Code: Select allname=DHT sensor library
version=1.0.0
author=Adafruit
maintainer=Adafruit <info@adafruit.com>
sentence=Arduino library for DHT11, DHT22, etc Temp & Humidity Sensors
paragraph=Arduino library for DHT11, DHT22, etc Temp & Humidity Sensors
category=Sensors
url=https://github.com/adafruit/DHT-sensor-library
architectures=*


For the ESP8266 you need to initialize with a 3rd parameter set to 16:
Code: Select all// Uncomment whatever type you're using!
//#define DHTTYPE DHT11   // DHT 11
//#define DHTTYPE DHT22   // DHT 22  (AM2302)
#define DHTTYPE DHT21   // DHT 21 (AM2301)

// init DHT; 3rd parameter = 16 works for ESP8266@80MHz
DHT dht(DHTPIN, DHTTYPE,16);
User avatar
By AcmeUK
#20276 Hi

Just tried to compile this in Adrduino IDE V1.6.4.

I get the following error message :-
Arduino: 1.6.4 (Windows 7), Board: "Generic ESP8266 board"

ESP_TH_Logger.ino: In function 'String MakeHTTPHeader(long unsigned int)':
ESP_TH_Logger:286: error: 'F' was not declared in this scope
ESP_TH_Logger.ino: In function 'String MakeHTTPFooter()':
ESP_TH_Logger:301: error: 'F' was not declared in this scope
ESP_TH_Logger.ino: In function 'void loop()':
ESP_TH_Logger:428: error: 'F' was not declared in this scope
ESP_TH_Logger:456: error: 'F' was not declared in this scope
ESP_TH_Logger:483: error: 'F' was not declared in this scope
ESP_TH_Logger:507: error: 'F' was not declared in this scope
'F' was not declared in this scope


Any ideas?
User avatar
By GerryKeely
#20348 Hi

The macro F(string_literal) is defined in WString.h which is "called" from Arduino.h and it would appear that this is missing.
In my distro Wstring.h is in same folder as the Arduino.h under C:\Users\Gerry\Application Data\Arduino15\packages\esp8266\hardware\esp8266\1.6.4-673-g8cd3697\cores\esp8266.

regards

Gerry