An electronic device and a method of controlling an electronic device are provided. The electronic device includes a main body; a light source provided inside the main body, the light source being configured to emit an output light; a projection lens configured to project the output light of the light source; and a cover configured to be selectively adjacent to or distanced from the projection lens, open or close the projection lens, and based on being adjacent to the projection lens, receive the output light projected by the projection lens and diffuse and emit the output light.