#include <DHT.h> //2
#include <LiquidCrystal_I2C.h> //3
//1 int TP = 5; //1
//1 int EP = 4; //1
//1 long durn; //1
//1 float speed_of_sound = 0.034; //1
//1 float dis_cm; //1
//2 const int DHT_PIN = 13; //2
//2 const int DHTTYPE = DHT22; //2
//2 DHT dht(DHT_PIN, DHTTYPE); //2
//3 LiquidCrystal_I2C lcd(0x27,16,2); //3
void setup() {
//หัวข้อที่ 1 IS Code Ultrasonic Distance Sensor
// Ultrasonic Distance Sensor คือ เซ็นเซอร์ที่ใช้สำหรับตรวจจับวัดถุต่างๆ โดยอาศัยหลักการสะท้อนของคลื่นความถี่เสียง
//1 Serial.begin(115200); //1
//1 pinMode(TP, OUTPUT); //1
//1 pinMode(EP, INPUT); //1
//หัวข้อที่ 2 DHT22(Digital Humidity and Temperature Sensor)
//DHT22 (Digital Humidity and Temperature Sensor) เป็นเซ็นเซอร์ที่เอาไว้ใช้สำหรับวัดอุณหภูมิและค่าความชื่นในอากาศ
//2 Serial.begin(115200); //2
//2 dht.begin(); //2
//หัวข้อที่ 3 LCD (Liquid Crystal Display) Currently Use 20*4(I2C)
//LCD (Liquid Crystal Display) เป็น จอที่ใช้แสดงผลแบบ Digital 20*4 = แสดงผลได้สูงสุด 4 บรรทัด บรรทัดละ 20 ตัวอักษร
//3 lcd.init(); //3
}
void loop() {
//1 digitalWrite(TP , LOW); //1
//1 delayMicroseconds(2); //1
//1 digitalWrite(TP, HIGH); //1
//1 delayMicroseconds(10); //1
//1 digitalWrite(TP , LOW); //1
//1 durn = pulseIn(EP, HIGH); /1
//1 dis_cm = durn* speed_of_sound/2; //1
//1 Serial.print("Distance:"); //1
//1 Serial.println(dis_cm); //1
//1 delay(1000); //1
//2 float temp = dht.readTemperature(); //2
//2 float humidity = dht.readHumidity(); //2
//2 Serial.println("Temp:" + String(temp, 1) + "C"); //2
//2 Serial.println("Humidity:" + String(humidity, 1) + "%"); //2
//2 Serial.println("-----"); //2
//2 delay(5000); //2
//3 lcd.backlight(); //3
//3 lcd.setCursor(2,1); //3
//3 lcd.print("Hello World"); //3
}