Most recent activity
-
check this link NRF51TAG.py
-
First approach to tare a scale with multiple calls and median filter.
var SCK = D23, DOUT = D24; scale = require('HX711').connect({ sck: SCK, miso: DOUT, }); function filterMedian(values) { var samples = values.length, median; var i = Math.floor(samples / 2); values.sort(function(a, b) { return a - b; }); if (samples % 2) { //even median = (values[i] + values[i + 1]) / 2; } else { // odd median = values[i]; } return median; } function scaleTare(samples, scale, cb) { var values = new Array(samples); var tare = function(x) { if (!scale.miso.read()) values[x] = scale.readRaw(); if (++x === samples) { scale.zero = filterMedian(values); cb(); } }; function setIntervalX(samples, delay, cb) { var x = 0; var id = setInterval(function() { cb(x); if (++x === samples) { clearInterval(id); } }, delay); } // 100ms deleay is needed when HX711 is in 10Hz mode to read another value // maybe add sps value to options like sps:10 = 100ms, sps:80 = 12,5ms setIntervalX(samples, 100, tare); } setTimeout(() => { scaleTare(10, scale, () => { console.log("scale is now tared"); }); }, 1E3);
Any hints and tweaks are welcome.
-
-
-
Did some test with HX711 module and PuckJS running 2v08.82
https://github.com/espruino/EspruinoDocs/blob/master/devices/HX711.js
Added an overview and detail screenshot for a
scale.readRaw()
using the HX711.js module.Does that HX711 return look correct?
-
No matter what device you use, with Espruino you always have a lot of fun.
Espruino Rocks 🤟
Special thanks goes to Gordon.