I want to display the DHT22 temperature and humidity sensor in a 3 digit 7 segments display. It's always showing the sensor value and after 2 or 3 sec the display turns off, and then the display turns on, and so on.
I need help to understand where is the mistake on the code to make the display always turned ON.
#include <SevSeg.h>
#include <EEPROM.h>
#include "DHT.h"
#define COMMON_ANODE 0
#define DHTPIN A0 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE);
int chk;
float hum; //Stores humidity value
float temp; //Stores temperature value
SevSeg sevseg;
void setup(){
byte numDigits = 3;
byte digitPins[] = {1,2,3};
byte segmentPins[] = {4,5,6,7,8,9,10,11};
sevseg.begin(COMMON_ANODE, numDigits, digitPins, segmentPins);
dht.begin();
}
void loop(){
temp= dht.readTemperature();
sevseg.setNumber(temp,1);
sevseg.refreshDisplay();
}