Incorporating functional molecules into sensor devices is an emerging area in molecular electronics that aims at exploiting the sensitivity of different molecules to their environment and turning it into an electrical signal. Among the emergent and integrated sensors, microelectromechanical systems (MEMS) are promising for their extreme sensitivity to mechanical events. However, to bring new functions to these devices, the functionalization of their surface with molecules is required. Herein, we present original electronic devices made of an organic microelectromechanical resonator functionalized with switchable magnetic molecules. The change of their mechanical properties and geometry induced by the switching of their magnetic state at a molecular level alters the device's dynamical behavior, resulting in a change of the resonance frequency. We demonstrate that these devices can be operated to sense light or thermal excitation. Moreover, thanks to the collective interaction of the switchable molecules, the device behaves as a non-volatile memory. Our results open up broad prospects of new flexible photo- and thermo-active hybrid devices for molecule-based data storage and sensors.