Page 4 of 19

Re: Thermostat

PostPosted: Sun Nov 22, 2015 9:52 pm
by Rotohammer
I have a pile of ESP-01's, so getting the 18B20 working on it is interesting to me as well.

So, I ran a test where I defined 5 instances of the 18B20 driver on 5 different pins, 2,4,5,12,13. Then I modified the temp command to take an additional pin number argument, so for example, while I had the oled still hooked up to I2C on pin 2 & 3, I ran:

Code: Select all temp 0 2 curr

(which means read sensor 0 on pin number 2)

which reported -196 degrees (since the 18B20 was still on pin 5, but the oled still worked!
Then I disconnected the oled from pin 2 and hooked the 18B20 to pin2, and it immediately started to read the temperature!

So, we may be able to define i2c on other pairs of pins as well, and as long as you don't try to perform I2c and onewire ops on the same pin in your program, it just may work fine in practice.

Re: Thermostat

PostPosted: Sun Nov 22, 2015 9:56 pm
by Mmiscool
This is excellent news. I was concerned that some thing wonkey would be happening if things were assigned to multiple pins.

Re: Thermostat

PostPosted: Sun Nov 22, 2015 10:02 pm
by Mmiscool
Mabe leave the existing command syntax alone and add a command to change the default pin for 1wire and i2c .

Can also put some thing on the setting page to define the pin.

Re: Thermostat

PostPosted: Sun Nov 22, 2015 10:10 pm
by Rotohammer
Theres pros having it setup via a command or as a setting.

Setting pro: the same code runs on different devices unchanged.

Command pro: the code defines the program completely.

I'm torn between the two :)