PROBLEM TO BE SOLVED: To provide electronic equipment that can be downsized, and an attachment/detachment detection program.SOLUTION: Electronic equipment includes a light emitting element 24 for emitting light Li to a living body B, a light receiving element 25 for receiving reflection light Lr of the light Li, and outputting a light volume signal SL indicating light volume of the reflection light Lr, a control part 37 for causing the light emitting element 24 to emit light by a first light emitting pattern in a first period T1, and causing the light emitting element 24 to emit light by a second light emitting pattern in a second period T2 by controlling the light emitting element 24, a calculation part 53 for calculating a pulse rate of the living body B based on the light volume signal SL when the light emitting element 24 is emitting light by the first light emitting pattern, and a determination part 51 for determining whether or not the equipment is mounted on the living body B based on the light volume signal SL when the light emitting element 24 is emitting light by the second light emitting pattern.SELECTED DRAWING: Figure 16COPYRIGHT: (C)2018,JPO&INPIT【課題】小型化が可能な電子機器及び着脱検知プログラムを提供すること。【解決手段】生体Bに向けて光Liを発光する発光素子24と、光Liの反射光Lrを受光し、反射光Lrの光量を示す光量信号SLを出力する受光素子25と、発光素子24を制御することにより、第1の期間T1においては発光素子24を第1の発光パターンで発光させ、第2の期間T2においては発光素子24を第2の発光パターンで発光させる制御部37と、発光素子24が第1の発光パターンで発光しているときに、光量信号SLに基づいて生体Bの脈拍数を算出する算出部53と、発光素子24が第2の発光パターンで発光しているときに、光量信号SLに基づいて生体Bに自装置が装着されているか否かを判定する判定部51とを有する電子機器による。【選択図】図16