
 نوشته اصلی توسط 
shelby
					 
				 
				اخه کجای کد سنسور دما بزارم؟
کتابخونه چی مال هر دوتاشو اضافه کنم؟
کد lcd رو میزارم تو لیکی که گفتی اگه میشه خودتم با این کد دمایی که اینجاست یه بار ادغام کن ممنون
			
		 
	 
 این کد رو تست بگیر ببین ارور داری؟
	کد:
	
#include <OneWire.h>
#include <DallasTemperature.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3);
void setup()
{
  Serial.begin(9600);
  LCD _Config();
  sensors.begin();
}
void loop()
{
  lcd.setCursor(0, 0); 
  lcd.print("Temp : !");
  sensors.requestTemperatures(); // Send the command to get temperatures
  lcd.write(sensors.getTempCByIndex(0));
}
void LCD _Config() {
  lcd.begin(16, 2);
  for (int i = 0; i < 3; i++) {
    lcd.backlight();
    delay(250);
    lcd.noBacklight();
    delay(250);
  }
  lcd.backlight();
  lcd.clear();
}