In this chapter, we explored the use of external sensors to improve the capabilities of our physical applications. We discovered how a sensor works and we took a look at an example that detects distance and object proximity.
As the first step, we got some information about the biological process of the heartbeat and we found how a photoresistor together with a bright LED could help us to detect the heart rate. We did some initial experiments using our first heart monitor prototype and collected various absolute values that we plotted later into a chart. After the first analysis, we saw that each peak could be a heartbeat and this brought us to enhance the reading phase with an algorithm capable of computing differences between readings during chosen intervals.
With the previous values, we plotted a new chart and discovered that we should check when there is a phase change to find a possible heartbeat. Indeed, our last work was to add a function to calculate the heart rate ready to...