#include <LiquidCrystal_I2C.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 11
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float Tfloat;
LiquidCrystal_I2C lcd(0x27,16,2);
void setup(void)
{
sensors.begin();
lcd.begin();
Serial.begin(9600);
}
void loop(void)
{
sensors.requestTemperatures();
Tfloat = sensors.getTempCByIndex(0);
Serial.print(Tfloat);
lcd.setCursor(0,0);
lcd.print("T = ");
lcd.print(Tfloat,4);
delay(250);
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น