PaulRB / WemosSensor

Indoor Temp, Humidity and/or Barometric pressure sensor using Wemos D1 Mini
43 stars 6 forks source link

SDA/SCL Init #1

Closed anthonyjclarke closed 7 years ago

anthonyjclarke commented 7 years ago

Hi Paul, not sure if this is the right way to "comment" here, but been using this code successfully on Wemos Mini v1... changed to a HTU sensor AND a new PRO board and could get no reads until I inserted "Wire.begin(D1, D2);"

Using latest Arduino IDE @ this time.

PaulRB commented 7 years ago

Hi Anthony. Thanks for raising this. But can I just check that you did not swap over the SDA and SCL lines when you re-made the circuit with the Mini Pro?

I think the links below indicate that Wire.begin() is equivalent to Wire.begin(D2, D1) rather than Wire.begin(D1, D2)

https://www.wemos.cc/product/d1-mini-pro.html

http://esp8266.github.io/Arduino/versions/2.0.0/doc/libraries.html#i2c-wire-library

anthonyjclarke commented 7 years ago

Away from device at moment, will check in a few days and come back to you...

anthonyjclarke commented 7 years ago

Something strange here.... I checked, SCL -> D1 and SDA -> D2. Using new Wemos Pro, here are excerpts of code to get an HTU Sensor to work Serial.println("Starting Wire"); //Wire.begin(D1, D2); //Wire.begin(2, 0); // For ESP-01 Serial.println("Wire started"); Seems strange... doesnt it... or am I missing the bl***y obvious! :)

PaulRB commented 7 years ago

Hi Anthony. Yes, a little strange, but, on the other hand, the line in question is commented out. Where did you find that code?

anthonyjclarke commented 7 years ago

ok, my bad in the post... but weird anyway.

Using Wemos D1, and your code : https://github.com/PaulRB/WemosSensor/blob/master/WiFiSensorIndoor.ino

I dont know what happened, but back to SCL -> D1 and SDA -> D2 and your original posting of Wire.begin(); and we're good...

I'm a bit new, I think I may have gone down a few rabbit holes.... sorry to bother you!

PaulRB commented 7 years ago

No worries Anthony. I'll close the issue. Re-raise if you find you can re-produce it again.