17.05.2016, 08:38
(This post was last modified: 17.05.2016, 08:39 by gjniewenhuijse.)
Oke, i can do a reading and custom precision with:
I know its theoretical, but can i change the precision by lm4 or do i need to connect them to a arduino and execute the following code:
Code:
require('ow')
value = ow.readfile('SENSORID', 'temperature', true) -- third argument will force a new conversion
log( round(value,1) )
I know its theoretical, but can i change the precision by lm4 or do i need to connect them to a arduino and execute the following code:
Code:
ds.search(addr); // address on 1wire bus
if (addr[0] == DS18B20) // check we are really using a DS18B20
{
ds.reset(); // rest 1-Wire
ds.select(addr); // select DS18B20
ds.write(0x4E); // write on scratchPad
ds.write(0x00); // User byte 0 - Unused
ds.write(0x00); // User byte 1 - Unused
ds.write(0x7F); // set up en 12 bits (0x7F)
ds.reset(); // reset 1-Wire
ds.select(addr); // select DS18B20
ds.write(0x48); // copy scratchpad to EEPROM, next reboot it has the new precision
delay(15); // wait for end of write
}