An electronic device comprising: a camera including a first emitter configured to emit a first electromagnetic wave corresponding to a first wavelength range including visible light range; a power management circuit is configured to supply current to the first emitter; a heart rate sensor including a second emitter and at least one detector, wherein the second emitter is configured to emit a second electromagnetic wave corresponding to a second wavelength range including infra-red light range, and the at least one detector is configured to detect an electromagnetic wave; and at least one processor, wherein the at least one processor is configured to: apply a first current level to the first emitter by using the power management circuit when a flash mode is enabled; apply a second current level lower than the first current level to the first emitter by using the power management circuit when a torch mode is enabled; obtain a user input to obtain spectral data of a target object outside the electronic device; emit the first electromagnetic wave by applying a third current level lower than the second current level to the first emitter by using the power management circuit, and the second electromagnetic wave by using the second emitter, in response to obtaining the user input, whereas at the third current level saturation of the at least one detector is avoided; obtain a first reflected signal of the first electromagnetic wave and a second reflected signal of the second electromagnetic wave, which are reflected by the target object, using the at least one detector; and obtain the spectral data of the target object based at least on the first reflected signal and the second reflected signal. a camera including a first emitter configured to emit a first electromagnetic wave corresponding to a first wavelength range including visible light range; a power management circuit is configured to supply current to the first emitter; a heart rate sensor including a second emitter and at least one detector, wherein the second emitter is configured to emit a second electromagnetic wave corresponding to a second wavelength range including infra-red light range, and the at least one detector is configured to detect an electromagnetic wave; and at least one processor, wherein the at least one processor is configured to: apply a first current level to the first emitter by using the power management circuit when a flash mode is enabled; apply a second current level lower than the first current level to the first emitter by using the power management circuit when a torch mode is enabled; obtain a user input to obtain spectral data of a target object outside the electronic device; emit the first electromagnetic wave by applying a third current level lower than the second current level to the first emitter by using the power management circuit, and the second electromagnetic wave by using the second emitter, in response to obtaining the user input, whereas at the third current level saturation of the at least one detector is avoided; obtain a first reflected signal of the first electromagnetic wave and a second reflected signal of the second electromagnetic wave, which are reflected by the target object, using the at least one detector; and obtain the spectral data of the target object based at least on the first reflected signal and the second reflected signal. apply a first current level to the first emitter by using the power management circuit when a flash mode is enabled; apply a second current level lower than the first current level to the first emitter by using the power management circuit when a torch mode is enabled; obtain a user input to obtain spectral data of a target object outside the electronic device; emit the first electromagnetic wave by applying a third current level lower than the second current level to the first emitter by using the power management circuit, and the second electromagnetic wave by using the second emitter, in response to obtaining the user input, whereas at the third current level saturation of the at least one detector is avoided; obtain a first reflected signal of the first electromagnetic wave and a second reflected signal of the second electromagnetic wave, which are reflected by the target object, using the at least one detector; and obtain the spectral data of the target object based at least on the first reflected signal and the second reflected signal.