Skip to content

Working

Shreyansh Singh edited this page Apr 19, 2021 · 4 revisions

The program is divided into two parts:

  • The c++ part which record the the pulse, analyse it to detect sleep and plays audio of the user's choice.
  • The User interface part which is implemented to view the graphs on a browser.

The C++ part

The main.cpp calls a timer object derived out of CppTimer. The timer is started with a time period of 2 ms. Every time the timer is fired signal from the ADC, and calculates BPM. When the BPM drops below a certain level, the program enters the state of maybesleep. If the state continues for a definite amount of time, then the program puts the sleep variable to True. When the sleep variable is True, another function detects it and forks the process to create a child process to play audio. The pid of the process which plays audio is killed whenever the subject's beats per minute value gets greater than the threshold.

For further information see Software Documentation