The code I used for that is:
var M = g.getWidth()/2; var yr,yg,yc,yd; var hrm; var n = 0; var sps = 0; Bangle.on("HRM-raw",h => { hrm = h; sps++; /*if (n=!n) */g.scroll(0,1); g.setPixel(M,0,"#ff0"); g.setColor(hrm.adjusted?"#000":"#0F0").fillRect(yg, 0,yg=(h.raw/32),0); g.setColor("#F00").fillRect(yr, 0,yr=(M + h.filt/256 - 30),0); g.setColor("#F0F").fillRect(yc, 0,yc=(M + (h.raw-h.avg)/128 + 30),0); if (hrm.isBeat) g.fillRect(yr-4, 0,yr+4,0); }); Bangle.setHRMPower(1); Bangle.setLCDTimeout(0); Bangle.setLCDPower(1) /*Bangle.on("HRM",h => { h.history.sort(); print(h); });*/ setInterval(function() { console.log(sps,"SPS"); sps=0; },1000);
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
The code I used for that is: