Port of PulseSensor code from Arduino to Python.