Improved pulse sensor - now follows Arduino code