-->
Page 1 of 1

DS18B20 reading

PostPosted: Wed Apr 27, 2016 2:49 pm
by grzesiu
Hi,
When reading more sensors in basic program and only one sensor (or no sensor) is connected basic show readings from other sensor

Code: Select alltemp 0 curr
temp 1 curs
temp 2 curt

when You connect only one sensor you get same temperature on curr, curs, curt variable

so i made simple change (maybe this is bad change but it works for me)
Code: Select all  if ( Param0 == "temp" | Param0 == "ti")
  {
    valParam1 = GetMeThatVar(Param1).toInt();
    valParam3 = GetMeThatVar(Param3).toInt();
    if(sensors.getAddress(tempDeviceAddress, valParam1)) {
      if( valParam3 >= 9 && valParam3 <= 12 ) {
        sensors.setResolution(tempDeviceAddress, valParam3);
      }
        sensors.requestTemperatures();
      SetMeThatVar(Param2, String(sensors.getTempC(tempDeviceAddress)));
    }
    else
    {
      SetMeThatVar(Param2, String(F("No sensor")));
    }
    return;
  }


I also add next parametr which set resolution of DS18B20 reading. For this You must declare variable tempDeviceAddress with
Code: Select allDeviceAddress tempDeviceAddress;

Re: DS18B20 reading

PostPosted: Wed Jun 01, 2016 11:38 pm
by forlotto
Hrmmm interesting another fella is having a problem with temp sensors too... This one in particular I wonder if it is not an update that possibly scrambled stuff up?

www.esp8266.com/viewtopic.php?f=153&t=1 ... 430#p48430