port: |
Grove: A1 (C16, C17) |
interface: | digital |
output values |
1/0, high/low |
Further information: | https://calliope.cc/en/examples/heart-rate-sensor |
Order: | https://www.exp-tech.de/module/seeed-grove-system/4728/seeed-studio-grove-ohrclip-herzfrequenz-sensor |
The Grove Ear-clip Heart Rate Sensor, is an ear-clip with an accompanying receiver, which can be used to measure the pulse.
Makecode
When the pulse beats, an increased voltage is measured via pin C16. This can be found under the "Advanced" blocks under "Pins > ... more" with the block "if pin P0 pulsed high". You only have to select the correct pin, which in this case is C16, and it is possible, for example, to have an LED light up simultaneously with the pulse. If the pulse is low and therefore on "low", the LED can be switched off again via the same block.
Python
Die digitalen Werte des Ear-clip Heart Rate Sensor können über den angeschlossenen Pin z.B. Grove-Pin pin_A1_RX über die Funktion read_digital() ausgelesen werden und z.B. in einer Variable gespeichert werden:
sensorwert = pin_A1_RX.read_digital()
Damit die Sensorwerte aktualisiert werde, müssen die digitalen Werte innerhalb der While-Schleife ausgelesen werden.
from calliopemini import *
while True:
sensorwert = pin_A1_RX.read_digital() # Wert von 0–1023
if sensorwert == 1:
display.show(Image.HAPPY)
else:
display.show(Image.SAD)