An electronic device includes a storage device, at least one processor, an indication device, a wearable sensor, and one or more modules that are stored in the storage device and executed by the at least one processor. The one or more modules includes a time setting module, a spectrum processing, a counting module, and a determination module. The time setting module controls the wearable sensor to sense physiological parameters of users and output a spectrum signal corresponding to the physiological parameters. The spectrum processing module filters the spectrum signal. The counting module counts a number of times the spectrum signal passes through the spectrum processing module and thus the counting module outputs an increment-by-one signal. The determination module has a predetermined threshold and determines whether the increment-by-one signal exceeds the predetermined threshold, the determination module activates the indication device if the increment-by-one signal exceeds the predetermined threshold.