mini project

Im kinda new to Arduino but i have a general knowledge on what to add and change in the sketch in compared to the Arduino and the breadboard attached.

my question......i would like to have a couple of sensors/switches that when attached it activates a little cylinder speaker alarming me when for say a door opens and the light turns on. example sensors/switches are a photo resistor, microswitch etc.

i know having the speaker as an output and having the sensors as input....but when i do digital write or analog write....do i need to do anything different? this is the part that confuses me

i appreciate your help

.but when i do digital write or analog write....do i need to do anything different?

Yes if you have a speaker attached through a resistor to a pin then you need to use the tone() function to make it work.
https://www.arduino.cc/en/Reference/Tone