A heartbeat sensor is included in the Arduino sensor set of 37.
The name makes too many promises.
People often think that it gives out a digital number—the heartbeat rate—through I2C or a similar standard.
The light sensor's output is merely an "analogue" value between 0 and 1023 that indicates the amount of infrared light it receives—that is, the amount of shade that was detected.
There is less infra-red light with a greater value.
To put it briefly, place your finger between the sensor's light transistor and IR led.
The blood vessels in your finger enlarge with each heartbeat, allowing the IR to be filtered out.