I need to do this project:
Design a circuit that includes an Arduino Uno board, a temperature and humidity sensor (22DHT), two dot matrices with drivers, a touch sensor, and some resistors. The circuit works in such a way that by default, the temperature is displayed in the matrix when the touch sensor is not touched, and the humidity is displayed when the touch sensor is touched. The temperature or humidity is displayed in one matrix and the emoticon associated with whether that temperature or humidity is desirable, too high, or too low is displayed in the second matrix.
Currently I have designed this circuit in Proteus:
This is my Code in Arduino CPP:
#include <LedControl.h>
#include <DHT.h>
#define DHTPIN 2
#define DHTTYPE DHT22
#define TOUCHPIN 3
#define DATAIN 11
#define CLK 13
#define LOAD1 10
#define LOAD2 9
DHT dht(DHTPIN, DHTTYPE);
LedControl lc1 = LedControl(DATAIN, CLK, LOAD1, 1);
LedControl lc2 = LedControl(DATAIN, CLK, LOAD2, 1);
void setup() {
Serial.begin(9600);
dht.begin();
pinMode(TOUCHPIN, INPUT);
lc1.shutdown(0, false);
lc1.setIntensity(0, 8);
lc1.clearDisplay(0);
lc2.shutdown(0, false);
lc2.setIntensity(0, 8);
lc2.clearDisplay(0);
}
void loop() {
float temp = dht.readTemperature();
float hum = dht.readHumidity();
if (isnan(temp) || isnan(hum)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
bool touch = digitalRead(TOUCHPIN);
if (touch == HIGH) {
displayNumber((int)hum, lc1);
displayEmoticon(getEmoticon(hum, "hum"), lc2);
} else {
displayNumber((int)temp, lc1);
displayEmoticon(getEmoticon(temp, "temp"), lc2);
}
delay(2000);
}
void displayNumber(int num, LedControl &lc) {
lc.clearDisplay(0);
if (num > 99) num = 99;
lc.setChar(0, 1, (num / 10) + '0', false);
lc.setChar(0, 0, (num % 10) + '0', false);
}
char getEmoticon(float value, String type) {
if (type == "temp") {
if (value < 18) return '-';
if (value > 28) return '+';
return ':';
} else if (type == "hum") {
if (value < 30) return '-';
if (value > 70) return '+';
return ':';
}
return '?';
}
void displayEmoticon(char emoticon, LedControl &lc) {
lc.clearDisplay(0);
switch (emoticon) {
case '-':
lc.setRow(0, 3, B00011000);
lc.setRow(0, 4, B00011000);
break;
case '+':
lc.setRow(0, 2, B00011000);
lc.setRow(0, 3, B01111110);
lc.setRow(0, 4, B01111110);
lc.setRow(0, 5, B00011000);
break;
case ':':
lc.setLed(0, 2, 3, true);
lc.setLed(0, 5, 3, true);
break;
case '?':
default:
lc.setRow(0, 3, B01000010);
lc.setRow(0, 4, B00100100);
break;
}
}
The problem is that when I start simulation, all dots in my displays turns on and they basically show nothing.

