Ok, I've just updated the module. Please could someone try:
var t = require("https://raw.githubusercontent.com/espruino/EspruinoDocs/master/devices/DS18B20.js").connect(new OneWire(A1));
t.getTemp(console.log);
And see if it works on DS18S20 as well?
I hopefully tidied it up a lot so it uses OneWire a bit more efficiently. It also checks the CRC now, so verify isn't needed and has been removed - the minified code is a smidge smaller too.
Personally I'd be tempted to remove isPresent, since a call to getTemp will just return null now.
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.
Ok, I've just updated the module. Please could someone try:
And see if it works on DS18S20 as well?
I hopefully tidied it up a lot so it uses OneWire a bit more efficiently. It also checks the CRC now, so
verify
isn't needed and has been removed - the minified code is a smidge smaller too.Personally I'd be tempted to remove
isPresent
, since a call togetTemp
will just returnnull
now.