The gator:particle, which includes the MAX30102 particle sensor can be purchased here. The gator:particle contains a MAX30102 particle sensor, which is mainly used for measuring heartrate.
To use this package, go to https://makecode.microbit.org, click Add package
and search for gator-particle. The package is located here
//Initializes the gator:particle so we can use it
gatorParticle.begin()
Use ||Initialize gator:particle sensor||
to start the gator:particle up so we can read from it.
//Reads a value from the Red or Infrared LED
gatorParticle.color(LEDToRead.Red)
Use ||Red value||
to get the value from the red channel. Grabbing the infrared channel is as easy as using the dropdown to call ||Infrared value||
//Reads the heartbeat of a finger pressed to the sensor in BPM or as a running average of 4 BPM readings.
gatorParticle.heartbeat(heartbeatType.BPM)
Use ||heartbeat in BPM||
to get the heartbeat of finger on the sensor in BPM. Grabbing the average BPM is as easy as using the dropdown to call ||heartbeat in AVG||
//Read red value and write it to the micro:bit screen as a bar graph.
gatorParticle.begin()
basic.forever(function () {
led.plotBarGraph(
gatorParticle.color(LEDToRead.red),
65000
)
})
- for PXT/microbit
MIT
gatorParticle=github:sparkfun/pxt-gator-particle