var p;
if ( process.env.CHIP_FAMILY == 'ESP8266' ) p=NodeMCU.D4;
else p = D23;
var ow = new OneWire(p);
ow.reset();
var d=require("DS18B20");
var sensor = d.connect(ow);
console.log(sensor.getTemp());
console.log(sensor.getTemp());
console.log(ow.search());
I have two sensors connected and see:
_____ _
| __|___ ___ ___ _ _|_|___ ___
| __|_ -| . | _| | | | | . |
|_____|___| _|_| |___|_|_|_|___|
|_| http://espruino.com
1v91.374 Copyright 2016 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate
>24.9375
24.9375
[
"28cc2e230500006b",
"283260dc04000001"
]
=undefined
>
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.
I've downloaded the firmware above and flashed with that:
Using:
I have two sensors connected and see: