Camera and Toglle Switch at Simultaneouse

Good evening.
I am a home assistant beginner so I encounter some problems.
I have an IP camera and I need a projector to illuminate the environment at night when I access the camera.
Is it possible, when I access the camera, to also turn on that projector simultaneously through the home assistant?
If yes, How can i do configuration.yaml? (example code).
Thank You