Hello
I have bought 2 AHT10 sensors and I want to do a small test to see if they work.
See code.
But getting a lot of errors?? I am using Arduino Uno R4 Wifi Thanks
The code
#include <Wire.h> #include <Adafruit_AHT10.h> AHT10 myAHT(0x38); void setup() { Wire.begin(); Serial.begin(9600); Serial.println ("Initialising AHT10 Sensor"); if (!myAHT10.begin ()) Serial.println("Sensor error!"); while(1); } void loop() { float temp = myAHT10.readTemperature (); float hum = myAHT10.readHumidity(); Serial.print("Temp:"); Serial.print (temp); Serial("°C"); Serial.print("Humidity:"); Serial.print (hum); Serial("%"); delay (1000); }
Errors
M:\Arduino Sketch\AHT10 sensor\sketch_apr7a_AHT10_test_2\sketch_apr7a_AHT10_test_2.ino:4:1: error: 'AHT10' does not name a type
AHT10 myAHT(0x38);
^~~~~
M:\Arduino Sketch\AHT10 sensor\sketch_apr7a_AHT10_test_2\sketch_apr7a_AHT10_test_2.ino: In function 'void setup()':
M:\Arduino Sketch\AHT10 sensor\sketch_apr7a_AHT10_test_2\sketch_apr7a_AHT10_test_2.ino:11:8: error: 'myAHT10' was not declared in this scope
if (!myAHT10.begin ())
^~~~~~~
M:\Arduino Sketch\AHT10 sensor\sketch_apr7a_AHT10_test_2\sketch_apr7a_AHT10_test_2.ino: In function 'void loop()':
M:\Arduino Sketch\AHT10 sensor\sketch_apr7a_AHT10_test_2\sketch_apr7a_AHT10_test_2.ino:18:15: error: 'myAHT10' was not declared in this scope
float temp = myAHT10.readTemperature ();
^~~~~~~
M:\Arduino Sketch\AHT10 sensor\sketch_apr7a_AHT10_test_2\sketch_apr7a_AHT10_test_2.ino:22:14: error: no match for call to '(UART) (const char [4])'
Serial("°C");
^
M:\Arduino Sketch\AHT10 sensor\sketch_apr7a_AHT10_test_2\sketch_apr7a_AHT10_test_2.ino:25:12: error: no match for call to '(UART) (const char [2])'
Serial("%");
^
exit status 1
Compilation error: 'AHT10' does not name a type