Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Sven Haiges
Published © CC BY

Calliope Heart Rate Sensor

Use a Calliope Mini and a Grove Heart Rate Sensor to visualize the heartbeats via the LED screen and calculate the BPM (beats per minute).

IntermediateFull instructions provided1 hour7,640
Calliope Heart Rate Sensor

Things used in this project

Hardware components

Calliope mini
Calliope mini
×1
Seeed Studio Grove - Finger-clip Heart Rate Sensor
×1

Story

Read more

Schematics

Calliope PXT Editor Screenshot

Code

Calliope PXT Editor JavaScript Code

JavaScript
let beats = 0
let sekunden = 0
basic.forever(() => {
    basic.pause(1000)
    sekunden += 1
    if (sekunden == 15) {
        sekunden = 0
        basic.showNumber(beats * 4)
        beats = 0
    }
})
pins.onPulsed(DigitalPin.C16, PulseValue.High, () => {
    beats += 1
    if (sekunden != 0) {
        basic.showLeds(`
            . # . # .
            # # # # #
            # # # # #
            . # # # .
            . . # . .
            `)
        basic.pause(25)
        basic.clearScreen()
    }
})
sekunden = 0
beats = 0

Credits

Sven Haiges

Sven Haiges

4 projects • 17 followers

Comments