Hi, I am having a problem with my AHT10 sensor wired into my arduino uno.
#include <Adafruit_AHTX0.h> // Temperature Sensor
#define aht_i2c_Address 0x3c
Adafruit_AHTX0 aht; // Temperature Sensor
float tempVal;
After initialising the sensor, the following code gives a strange error.
tempVal = aht._temperature;
float _temperature, ///< Last reading's temperature (C)
^~~~~~~~~~~~
exit status 1
Compilation error: 'float Adafruit_AHTX0::_temperature' is protected within this context
I tried this but it seems to be causing the void setup() to repeat itself over and over again. (I can tell because all my void setup() does is initialise a display, and its being initialised over and over again)
I just tried the sketch that @Ron_Blain provided with an Uno R3 and an AHT20. It worked as expected.
Monitor port settings:
baudrate=115200
Connected to /dev/ttyUSB0! Press CTRL-C to exit.
Adafruit AHT10/AHT20 demo!
AHT10 or AHT20 found
Temperature: 24.14 degrees C
Humidity: 37.73% rH
Temperature: 24.14 degrees C
Humidity: 37.73% rH
Temperature: 24.14 degrees C
Humidity: 37.73% rH
I'd try your sketch, @SunnyFlops, but you've yet to show it.
Well, I've been able to make an AHT20 work. You haven't. And you still haven't shown your complete sketch that you claim fails. I'm not a mind reader, and I'm done waiting. Good luck, and good-bye.