Comments (6)
Hi jhengstermann,
to set the initial value to HIGH you must set pin to INPUT_PULLUP.
Bye Renzo
from pcf8574_library.
I think there is still a problem, or i'am misunderstanding something
I've added a couple of debug lines to the digitalReadAll
function and this is the output:
10:39:37.003 -> W: 0 R ALL: 1 R Down: 0R Up: 1
10:39:37.003 -> Set pin 1 as 2
10:39:37.003 -> W: 0 R ALL: 11 R Down: 0R Up: 11
10:39:37.003 -> Set pin 2 as 2
10:39:37.003 -> W: 0 R ALL: 111 R Down: 0R Up: 111
10:39:37.003 -> Set pin 3 as 2
10:39:37.003 -> W: 0 R ALL: 1111 R Down: 0R Up: 1111
10:39:37.003 -> Set pin 4 as 2
10:39:37.003 -> W: 0 R ALL: 11111 R Down: 0R Up: 11111
10:39:37.003 -> Set pin 5 as 2
10:39:37.003 -> W: 0 R ALL: 111111 R Down: 0R Up: 111111
10:39:37.003 -> Set pin 6 as 2
10:39:37.003 -> W: 0 R ALL: 1111111 R Down: 0R Up: 1111111
10:39:37.003 -> Set pin 7 as 2
10:39:37.003 -> W: 0 R ALL: 11111111 R Down: 0R Up: 11111111
10:39:37.003 -> Read from buffer
10:39:37.003 -> Data ready
10:39:37.003 -> Input 11111111Buffer value 0
10:39:37.003 -> Buffer hight value readed set readed 0
10:39:37.003 -> Return value: 00000000
you can see that the byte read from i2c (Input) is B11111111, which is correct, because the pins are all high on startup.
But the return value is all 00000000
from pcf8574_library.
Hi,
can you post your code.
Thanks Renzo
from pcf8574_library.
here it is:
#define GPIO_EXP_ADR 0x38
#include <Arduino.h>
#include "PCF8574.h"
PCF8574 ioX_pcf8574(GPIO_EXP_ADR);
void setup() {
Serial.begin(115200);
Serial.println();
delay(10);
ioX_pcf8574.begin();
delay(10);
for (int i=0; i<8; i++) {
ioX_pcf8574.pinMode(i, INPUT_PULLUP);
}
delay(10);
ioX_pcf8574.digitalReadAll();
}
void loop() {
}
and in PCF8574.cpp
i just added these print statements to the end of PCF8574::DigitalInput PCF8574::digitalReadAll(void)
DEBUG_PRINT(digitalInput.p0);
DEBUG_PRINT(digitalInput.p1);
DEBUG_PRINT(digitalInput.p2);
DEBUG_PRINT(digitalInput.p3);
DEBUG_PRINT(digitalInput.p4);
DEBUG_PRINT(digitalInput.p5);
DEBUG_PRINT(digitalInput.p6);
DEBUG_PRINTLN(digitalInput.p7);
im using an ESP8266.
from pcf8574_library.
Hi jhengstermann,
I spent hours trying to debug your problem, couldn't figure out why it happened.
But in the end I didn't notice the most obvious thing.
You put the begin of the pcf8574 before the pins initialization: P.
Bye Renzo
from pcf8574_library.
yeah thanks 🙏
from pcf8574_library.
Related Issues (20)
- PCF8574 with HC-SR04 UltraSonic Sensor HOT 5
- Low memory Read All not working HOT 3
- Wont compile at all esp32 HOT 1
- if (pcf8574.begin()) is always ko !!! HOT 2
- digitalWrite(PIN, LOW) changes all pins to LOW HOT 1
- Error when compiling. HOT 2
- Lockup on PCF8574::begin() on ESP32 due to unpaired beginTransmission() call HOT 2
- Got digitalReadAll to work, but digitalRead is not? HOT 4
- Do library examples work with ESP32 2.02 ?? HOT 8
- class PCF8574' has no member named 'pinMode' HOT 3
- Won't compile with ESP8266 DevKit 1 HOT 2
- Both digitalReadAll and digitalRead return same value for all INPUT or INPUT_PULLUP pins HOT 6
- aduino web editor HOT 2
- Raspberry Pi Pico W with multiple PCF8574 HOT 1
- problem with interrupt HOT 1
- OUTPUT SET TO HIGH DURING BEGIN HOT 3
- Compilation error: expected initializer before 'updateEncoder' HOT 3
- Couldn't initialize HOT 1
- Changing Output to Input mid program HOT 1
- Unable to call in ESP32 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pcf8574_library.