Hi,
I use the lib DHTLib and recognized an error within the espressif8266-platform
similar main.cpp in both examples:
//
// FILE: dht33_test.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.01
// PURPOSE: DHT library test sketch for DHT33 && Arduino
// URL:
//
// Released to the public domain
//
include <dht.h>
dht DHT;
#define DHT33_PIN 9
void setup()
{
Serial.begin(115200);
Serial.println("DHT TEST PROGRAM ");
Serial.print("LIBRARY VERSION: ");
Serial.println(DHT_LIB_VERSION);
Serial.println();
Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)\tTime (us)");
}
void loop()
{
// READ DATA
Serial.print("DHT33, \t");
uint32_t start = micros();
int chk = DHT.read33(DHT33_PIN);
uint32_t stop = micros();
switch (chk)
{
case DHTLIB_OK:
Serial.print("OK,\t");
break;
case DHTLIB_ERROR_CHECKSUM:
Serial.print("Checksum error,\t");
break;
case DHTLIB_ERROR_TIMEOUT:
Serial.print("Time out error,\t");
break;
case DHTLIB_ERROR_CONNECT:
Serial.print("Connect error,\t");
break;
case DHTLIB_ERROR_ACK_L:
Serial.print("Ack Low error,\t");
break;
case DHTLIB_ERROR_ACK_H:
Serial.print("Ack High error,\t");
break;
default:
Serial.print("Unknown error,\t");
break;
}
// DISPLAY DATA
Serial.print(DHT.humidity, 1);
Serial.print(",\t");
Serial.print(DHT.temperature, 1);
Serial.print(",\t");
Serial.print(stop - start);
Serial.println();
// FOR UNO + DHT33 400ms SEEMS TO BE MINIMUM DELAY BETWEEN SENSOR READS,
// ADJUST TO YOUR NEEDS
delay(1000);
}
//
// END OF FILE
//
I use the following platform.ini:
[env:nodemcuv2]
platform = espressif8266
board = nodemcuv2
framework = arduino
lib_deps = DHTlib
and:
[env:uno]
platform = atmelavr
board = uno
framework = arduino
lib_deps = DHTlib
I get the following error message, when I use the espressif-plattform:
In file included from .piolibdeps\DHTlib_ID1336\dht.h:19:0, from .piolibdeps\DHTlib_ID1336\dht.cpp:41:
.piolibdeps\DHTlib_ID1336\dht.cpp: In member function 'int8_t dht::_readSensor(uint8_t, uint8_t, uint8_t)':
C:\Users\XXX\.platformio\packages\framework-arduinoespressif8266\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)
^
.piolibdeps\DHTlib_ID1336\dht.cpp:121:29: note: in expansion of macro 'portInputRegister'
volatile uint8_t *PIR = portInputRegister(port);
^
*** [.pioenvs\nodemcuv2\lib\DHTlib_ID1336\dht.o] Error 1
When I use the atmelavr platform, no error happens.
Can ypu please check and update the platform.
THX, GL