Skip to content

Commit 5500efd

Browse files
authored
Merge pull request #193 from Simonas0/master
Unpull DOUT pin for ESPRESSIF boards
2 parents bc5a7e5 + c646a33 commit 5500efd

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/HX711.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ uint8_t shiftInSlow(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) {
6161
#define SHIFTIN_WITH_SPEED_SUPPORT(data,clock,order) shiftIn(data,clock,order)
6262
#endif
6363

64+
#ifdef ARCH_ESPRESSIF
65+
// ESP8266 doesn't read values between 0x20000 and 0x30000 when DOUT is pulled up.
66+
#define DOUT_MODE INPUT
67+
#else
68+
#define DOUT_MODE INPUT_PULLUP
69+
#endif
70+
6471

6572
HX711::HX711() {
6673
}
@@ -73,7 +80,7 @@ void HX711::begin(byte dout, byte pd_sck, byte gain) {
7380
DOUT = dout;
7481

7582
pinMode(PD_SCK, OUTPUT);
76-
pinMode(DOUT, INPUT_PULLUP);
83+
pinMode(DOUT, DOUT_MODE);
7784

7885
set_gain(gain);
7986
}

0 commit comments

Comments
 (0)