The following video shows the fan where we have to use C++ to code the Arduino to receive analog input from the sensor and output to the relay that controlled the fan to turn on and off.
first I had to understand the way a relay works and its function and then I had to learn how to wire it to the fan and the Arduino and breadboard. originally it kept short curating because one of the pins was not in the correct spot. Then the connections between the 5v and the breadboard were not connected correctly since they overlapped with a different line. I later had to code the analog input with the correct amount of light that could detect my flashlight from the light in the room turn on the fan if it is over a certain amount of light and turn it off when there is little amount of light.