KY039 Arduino Heart rate code

Like you are holding the sensor in the picture it can not work. The light from the led is going over your finger. The concept is that it reflects from your finger tot the phototransistor. Or it goes trough your finger.
So you will have to point the led on your finger, for it to work.