the idea is a smart home device that senses two things.
temperature/humidity , and sunlight
when it senses sunlight it activates automatic curtains to close and cover the window
and display the temperature and humidity for the user
The components of the project:
Arduino - ldr module - lcd screen - h bridge module - motor - jumper wires - breadboard
LDR module
DHT module
H-bridge module
LCD screen I2C
Geared motor
wired the components to Arduino using the schematic shown in tinkercad
first attach DHT to bread board and wire power jumpers as shown and data pin to pin 3
then add LDR module next to DHT and wire power , digital output ( DO ) to pin 4 on arduino
add the sreen SCL to pin A5
SDA to pin A4
and power wires of course
H-bridge
wire in1& in2 to pins 6 and 7
ena to pin 5
and wire the power from an external power source
wire the motor to OUT 1 & OUT 2
first included the needed libraries
and set variables
then set inputs and outputs pins and serial monitor settings
this part controls the motor which closes and opens the blinds
( if the sun is rising close the curtains )
the DHT part and defining its parameters and printing the atmosphere stats on the serial monitor
the final step is the LCD part tell Arduino to print temp and humidity on separate lines on the screen to be displayed at the same time
the problem was a clash between the auto mode and the manual mode, that made one mode only work at the time
we discovered the problem when Menna our instructor mentioned that we need to separate the two modes to troubleshoot and find where is the problem and that really worked well
we solved the problem when adding if condition and else that separated each mode and wiped off the problem and the code worked flawlessly
in conclusion you should separate the functions if they have the same IN/OUTPUTS
to avoid clashes between them.