Some resources to help you getting started with STM32 programming.
This is a small device called a reed switch. When the device is exposed to a magnetic field, the two ferrous materials inside the switch pull together and the switch closes. When the magnetic field is removed, the reeds separate and the switch opens. This makes for a great non-contact switch. This switch can carry up to 0.55A.
The basic reed switch consists of two identical flattened ferromagnetic reeds, sealed in a dry inert-gas atmosphere within a glass capsule, thereby protecting the contact from contamination. The reeds are sealed in the capsule in cantilever form so that their free ends overlap and are separated by a small air gap.
Note: Images are just for representational purpose only.