I come from some basic Arduino coding and I tried the spark-dallas-temperature.h and OneWire.h (thanks @krvarma for the great work!)
I was able to read eight ds18b20 (and send the data to Gdrive, thanks @binaryfrost), but I did it without a direct reference to the sensor serial number as I was able to do with the Arduino’s library (DallasTemperature.h).
Below is the piece of code for Spark (100* is to bypass the limitation on the float). Everything works, but I would like to be sure that each variable “temperature …” always refers to the same sensor, while if one sensor stops working, I see -12700 as “temperature8” , but I do not know which sensor is not working anymore.
Figured it out
ds.write(0x44, 1); // is for parasite mode
ds.write(0x44); // is for non-parasite mode
The problem I was having was answered a little higher up
present = ds.reset();
ds.select(addr);
ds.write(0xBE, 0); // Read Scratchpad 0
ds.write(0x00,0); // Recall Memory 0 <--------ERASE THIS LINE
I setup a network to do temperature monitoring using 5 DS18B20s connected to the 2 unused lines on my POTS land line. Your phoneline is probably 4 wire and each landline only uses 2 of them. So - you have jacks already in your house and you won’t have to run new wiring to each room.
It worked well with a run approx 200 feet long.
Make sure (of course) to disconnect the lines at the TelCo box.
I have considered using them for a CANbus so small modules could communicate around the house. But now with how cheap the photon is, it’s hardly worth the trouble.
Are you having trouble with negative values or are you just asking? The code uses int16_t, a 16-bit signed type to hold the results from the 18b20, which sign-extends its result to 16-bits. So I think negative values are handled properly.