Files
ESPEasy/lib/AM2320/example/AM2320lib_test/AM2320lib_test.ino
T
krikkandDatuX 1cefa5eb1b AM2320: negative temperature fix... (#312)
* switched the library, now uses a library which correctly handles negative temperatures

* minor change
2017-05-27 17:55:13 +02:00

30 lines
469 B
Arduino

#include <Wire.h>
#include <AM2320.h>
AM2320 th;
void setup() {
Serial.begin(9600);
Wire.begin();
}
void loop() {
switch(th.Read()) {
case 2:
Serial.println("CRC failed");
break;
case 1:
Serial.println("Sensor offline");
break;
case 0:
Serial.print("humidity: ");
Serial.print(th.h);
Serial.print("%, temperature: ");
Serial.print(th.t);
Serial.println("*C");
break;
}
delay(200);
}