Reed switches close when a magnet is placed near their casing. In this project, a magnet could be mounted on a window and the reed switch on the windowsill so that every time the window was opened, the piezo buzzer would make an alarm sound.

Use a simple reed switch, a piezo and a 10kΩ pull-down resistor. Connect the piezo to PWM pin 9 and to ground. Connect one of the reed switch's pins to +5V and the other to digital pin 12 and through the pull-down resistor to ground. Use a magnet to control the reed switch.