Questions with regards to ESP8266 Basic and hardware interfacing and control via Basic commands

Moderator: Mmiscool

User avatar
By siddharthtaunk
#62206 Hi,

I have written the following code for retrieveing the temperature data from DS18B20.

Code: Select allcls
button "READ TEMP",[BUTTON]
wait

[BUTTON]
bla = temp(287)
print bla
wait


But this returns -127

I have made the connection as in the link below.
https://www.tweaking4all.com/hardware/a ... re-sensor/

I have not coonected the ardino instead have esp12e there.

Please help.

Thanks and regards.
Sidharth
User avatar
By Mmiscool
#62218 I would use temp(0) if you only have one sensor connected. For each aditional sensor connected increment the number.

Print temp(0)
Print temp(1)
User avatar
By Electroguard
#70168 Without getting bogged down with your specifics... the -127 value means the Dallas 1-wire device is not communicating with the ESP, else it should return a postive temperature value.

As far as hardware is concerned, reducing the value of the parasitic pullup resistor to 1K should improve reliability of 1-wire operation.

As far as software is concerned, rather than ask for a response from a specified device on the 1-wire bus, try getting the temp from any devices that can be found, ie the Docs state...
Bla = temp({Device ID})
With no arguments, all connected ROM codes are returned as a space separated string.