A non-transitory computer readable storage medium storing a set of instructions, when executed by at least one processor of an electronic device, cause the at least one processor to perform a method of the electronic device comprising an alarm function, the method comprising:
- (a) setting an alarm time, an alarm mode and a plurality of control modes of the alarm function, and setting a shaking frequency and an audio file corresponding to each of the plurality of control modes in a storage system of the electronic device;
- (b) starting the alarm function by activating the alarm mode and monitoring acceleration values of the electronic device using a monitor unit of the electronic device, when a current time of the electronic device matches the alarm time;
- (c) recording a first shaking frequency of the electronic device in a first predetermined time limit, according to the acceleration values from the monitor unit;
- (d) confirming the control mode corresponding to the first shaking frequency, and outputting the audio file corresponding to the confirmed control mode to a voice output device of the electronic device;
- (e) controlling the alarm function according to the confirmed control mode.