Created
May 18, 2018 12:59
-
-
Save arduinothai/188a94847cd7ce2d3a0015e5839832b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Wire.h> | |
#include <AM2320.h> | |
AM2320 th; | |
void setup() { | |
Serial.begin(9600); | |
} | |
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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment