Hi, guys
I am doing a test with a DHT22 and an arduino UNO and a 3.5TFTLCD Shield "I have never worked with this LCD", and I can not update the data coming from the DHT22 on the LCD. I would really like it if you can help me select this problem.
I leave here the code as well as a photo of the problem I'm having.
I also made a FOR counter and it also does not show the correct numbers
Thank you in advance for all the help
#include <Adafruit_GFX.h> //graphix library for drawing
#include <Adafruit_TFTLCD.h> //LCD library to drive screen
#include "DHT.h" //dht library#define LCD_CS A3 // Chip Select goes to Analog 3
#define LCD_CD A2 // Command/Data goes to Analog 2
#define LCD_WR A1 // LCD Write goes to Analog 1
#define LCD_RD A0 // LCD Read goes to Analog 0#define LCD_RESET A4 //LCD reset to analog 4
#define DHTPIN 53 //dht22 on digital 53 (Mega)
#define DHTTYPE DHT22 //define dht type (11,21,22)#define BLACK 0x0000 //hex colors to english
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFFAdafruit_TFTLCD tft(LCD_CS, LCD_CD, LCD_WR, LCD_RD, LCD_RESET); //create instance of LCD called tft
DHT dht(DHTPIN, DHTTYPE); //create instance of dht called dht
String t;
void setup(void) {
Serial.begin(9600); //serial comms for debugtft.reset(); //reset the screen
tft.begin(0x9341); //start screen using chip identifier hex
tft.setRotation(3);
tft.fillScreen(BLACK);
}void loop(void) {
float f = dht.readTemperature(); //read temp in F from dht22
float h = dht.readHumidity(); //read humidity from dht
tft.setCursor(0, 0); //cursor to upper lefttft.setTextColor(WHITE); //set text color white
tft.setTextSize(3); //set text size to 2 (1-6)
tft.println(" Temperature Humidity"); //print header to screentft.drawRoundRect(10, 50, 180, 100, 6, WHITE); //draw rounded box (x,y,width,height,radius,color)
tft.drawRoundRect(220, 50, 180, 100, 6, WHITE); //draw rounded box (x,y,width,height,radius,color)tft.setTextColor(GREEN); //set text color to green
tft.setTextSize(4); //set text size 4
tft.setCursor(40, 85); //put cursor in left box
tft.print(f); //print the temperaturetft.setCursor(240, 85); //put cursor in right box
tft.print(h); ; //print the humidity
tft.setCursor(85, 250); //put cursor in right boxfor(int i=0;i<10;i++)
{
tft.setCursor(85, 250);
tft.setTextColor(GREEN); //set text color to green
tft.setTextSize(4);
tft.print(i);delay(3000);//wait 3 seconds
}