Hi everyone. I have here a problem witch never see.
In this image is the values of Dht11 sensor.
Code is exaples DHT11.
//
// FILE: dht11_test.ino
// AUTHOR: Rob Tillaart
// PURPOSE: DHT library test sketch for DHT11 && Arduino
// URL: https://github.com/RobTillaart/DHTlib
#include <dht.h>
dht DHT;
#define DHT11_PIN 10
void setup()
{
Serial.begin(115200);
Serial.println("DHT TEST PROGRAM ");
Serial.print("LIBRARY VERSION: ");
Serial.println(DHT_LIB_VERSION);
Serial.println();
Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");
}
void loop()
{
// READ DATA
Serial.print("DHT11, \t");
int chk = DHT.read11(DHT11_PIN);
switch (chk)
{
case DHTLIB_OK:
Serial.print("OK,\t");
break;
case DHTLIB_ERROR_CHECKSUM:
Serial.print("Checksum error,\t");
break;
case DHTLIB_ERROR_TIMEOUT:
Serial.print("Time out error,\t");
break;
case DHTLIB_ERROR_CONNECT:
Serial.print("Connect error,\t");
break;
case DHTLIB_ERROR_ACK_L:
Serial.print("Ack Low error,\t");
break;
case DHTLIB_ERROR_ACK_H:
Serial.print("Ack High error,\t");
break;
default:
Serial.print("Unknown error,\t");
break;
}
// DISPLAY DATA
Serial.print(DHT.humidity, 1);
Serial.print(",\t");
Serial.println(DHT.temperature, 1);
delay(2000);
}
// -- END OF FILE --
What can I do???
serafim11:
Serial.begin(115200);
Did you remember to change the serial monitor line speed?
6v6gt
March 3, 2022, 11:19am
3
I'm impressed that the code you have shown could write anything at all on that display.
The code from LCD is:
#include <LiquidCrystal.h>
#include <dht.h>
#include <DS3232RTC.h>
#include <Adafruit_Sensor.h>
#include <SPI.h>
#include <Wire.h>
#include <nRF24L01.h>
#include <printf.h>
#include <RF24.h>
#include <RF24_config.h>
#include <DS3231.h>
dht DHT; //create DHT object
#define DHT11_PIN 10 //DHT11 senzor
#define DHTTYPE DHT11
int chk;
float hum;
float temperature[2];
String inTemp, inHum, outTemp, outHum;
int readDHT11, t, h;
double Fahrenheit(double celsius) {
return ((double)(9 / 5) * celsius) + 32;
}
double Kelvin(double celsius) {
return celsius + 273.15;
}
DS3231 rtc(SDA, SCL); //create DS3231 object
RF24 radio(8, 9); //8 for CE, 9 for CSN
const byte address[6] = "00001";
char text[6] = "";
const int rs = 7, en = 6, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
void setup()
{
lcd.begin(16, 2);
rtc.begin(); //initialize the rtc
rtc.setDOW(FRIDAY); //set Day
rtc.setTime(12, 0, 0); //set Time
rtc.setDate(1, 1, 2022); //set Date
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
lcd.setCursor(0, 0);
lcd.print("Statie Meteo 2.0");
delay(5000);
lcd.clear();
lcd.setCursor(2, 0);
lcd.print("Developed By");
lcd.setCursor(2, 1);
lcd.print(" Serafim");
delay(3000);
lcd.clear();
lcd.print("Pornire....");
delay(3000);
lcd.clear();
}
void loop() {
{
lcd.setCursor(0, 0);
lcd.print("Date: ");
lcd.print(rtc.getDateStr()); //print date
lcd.setCursor(0, 1);
lcd.print("Time:");
lcd.print(rtc.getTimeStr());
delay(5000);
lcd.clear();
}
{
int chk = DHT.read11(DHT11_PIN);
lcd.setCursor(0, 0);
lcd.print("Indoor:");
lcd.setCursor(0, 9);
Serial.print(DHT.temperature);
lcd.print(DHT.temperature);
lcd.print((char)178);
lcd.print("C");
}
if ( radio.available() ) {
radio.read(&text, sizeof(text)); // Read incoming data
outTemp = String(text[0]) + String(text[1]) + char(176) + "C"; // Outdoor Temperature
outHum = String(text[2]) + String(text[3]) + "%"; // Outdoor Humidity
lcd.setCursor(0, 0);
lcd.print("Temp");
lcd.setCursor(0, 1);
lcd.print("Humidity");
lcd.setCursor(0,9);
lcd.print(outTemp);
lcd.print(" C");
lcd.setCursor(9, 10);
lcd.print(outHum);
lcd.print( "%");
delay(10000);
}
}
It was worth a try - difficult to tell what it was set to from a crappy picture.
Good luck.
6v6gt
March 3, 2022, 4:48pm
7
That is from the code in post #4 but there does not appear to be a matching Serial.begin() statement.
Also, you appear to have two DS3231 libraries defined. One usually is enough.
I solve this error with this video...
Hi again bro!
How can I change lcd bund speed to 9600??
Do you have a serial LCD?
Because if not, the question makes little sense.
Note just a regular lcd 1602
In which case, it isn't a serial device, so the answer is "you can't".
But How can I make dht values to apeear like on serial monitor. The write is still like in photo.
Does your simple LCD "hello world" sketch display correctly, as you expect?
6v6gt
March 6, 2022, 3:31pm
16
serafim11:
outTemp = String(text[0]) + String(text[1]) + char(176) + "C"; // Outdoor Temperature
outHum = String(text[2]) + String(text[3]) + "%"; // Outdoor Humidity
lcd.setCursor(0, 0);
lcd.print("Temp");
lcd.setCursor(0, 1);
lcd.print("Humidity");
lcd.setCursor(0,9);
lcd.print(outTemp);
lcd.print(" C");
lcd.setCursor(9, 10);
lcd.print(outHum);
lcd.print( "%");
delay(10000);
}
}
Start looking here. Bear in mind that these are the arguments for setCursor:
lcd.setCursor(col, row)
You seem to have some odd looking values for a 16*2 display
Thanks a lot man! Now is working very good!!
system
Closed
September 2, 2022, 3:43pm
18
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.