نوشته اصلی توسط
hamed82
دوستان سلام با استفاده از کدهای مثال کتابخانه SHT1x.h سعی کردم دوتا سنسور SHT10 رو راه اندازی کنم ولی هر دفعه مقادیر بازگشتی از سنسور اعداد منفی رو نشون میده تو اتاق
Temperature: -40.0099983215C / -40.0180015563F. Humidity: -4.69%
Temperature: -40.0099983215C / -40.0180015563F. Humidity: -4.69%
Temperature: -40.0099983215C / -40.0180015563F. Humidity: -4.69%
Temperature: -40.0099983215C / -40.0180015563F. Humidity: -4.69%
Temperature: -40.0099983215C / -40.0180015563F. Humidity: -4.69%
Temperature: -40.0099983215C / -40.0180015563F. Humidity: -4.69%
Temperature: -40.0099983215C / -40.0180015563F. Humidity: -4.69%
Temperature: -40.0099983215C / -40.0180015563F. Humidity: -4.69%
کد هم اینجا کپی میکنم:
#include <LiquidCrystal.h>
#include <SHT1x.h>
// Specify data and clock connections and instantiate SHT1x object
#define dataPin 2
#define clockPin 3
SHT1x sht10r(dataPin, clockPin);
LiquidCrystal lcd(53,52,51,50,49,48,47);
void setup()
{
lcd.begin(20,4);
Serial.begin(38400); // Open serial connection to report values to host
lcd.print("Starting up");
}
void loop()
{
float temp_c;
float temp_f;
float humidity;
// Read values from the sensor
temp_c = sht10r.readTemperatureC();
temp_f = sht10r.readTemperatureF();
humidity = sht10r.readHumidity();
// Print the values to the serial port
Serial.print("Temperature: ");
lcd.print("Temperature: ");
Serial.print(temp_c, DEC);
lcd.print(temp_c);
Serial.print("C / ");
Serial.print(temp_f, DEC);
Serial.print("F. Humidity: ");
Serial.print(humidity);
lcd.print("Humidity: ");
lcd.print(humidity);
Serial.println("%");
delay(2000);
}
کمک کنید لطفا
این کد رو آپلود کن ببین رو کنسوبل آردوینوت چی میبینی ؟
دقت کن شماره پینهاش با کد شما فرق داره
کد:
#include <SHT1x.h>
// Specify data and clock connections and instantiate SHT1x object
#define dataPin 10
#define clockPin 11
SHT1x sht1x(dataPin, clockPin);
void setup()
{
Serial.begin(38400); // Open serial connection to report values to host
Serial.println("Starting up");
}
void loop()
{
float temp_c;
float temp_f;
float humidity;
// Read values from the sensor
temp_c = sht1x.readTemperatureC();
temp_f = sht1x.readTemperatureF();
humidity = sht1x.readHumidity();
// Print the values to the serial port
Serial.print("Temperature: ");
Serial.print(temp_c, DEC);
Serial.print("C / ");
Serial.print(temp_f, DEC);
Serial.print("F. Humidity: ");
Serial.print(humidity);
Serial.println("%");
delay(2000);
}