- This topic has 0 replies, 1 voice, and was last updated 2 years, 8 months ago by .
Viewing 0 reply threads
Viewing 0 reply threads
- You must be logged in to reply to this topic.
Home › Forums › The libraries hosted on the site › PCF8575 16bits i2c digital I/O expander › can’t read INPUT with PCF8575 when some IOs use for OUTPUT at the same time
can’t read INPUT with PCF8575 when some IOs use for OUTPUT at the same time
Hello, i have use the PCF8575, some GPIOs work for INPUT, some work for OUTPUT.
But now, i can’t read INPUT state. when the code Serial.println(p15Digital); always =0
how to solve it, thanks!
here is my code:
PCF8575 PCF8575_IN4(&I2Cone,0x26,4,16);
PCF8575_IN4.pinMode(0,INPUT);
PCF8575_IN4.pinMode(1,INPUT);
PCF8575_IN4.pinMode(2,INPUT);
PCF8575_IN4.pinMode(3,INPUT);
PCF8575_IN4.pinMode(4,INPUT);
PCF8575_IN4.pinMode(5,INPUT);
PCF8575_IN4.pinMode(6,INPUT);
PCF8575_IN4.pinMode(7,INPUT);
PCF8575_IN4.pinMode(8,OUTPUT); // for 74HC4067-A
PCF8575_IN4.pinMode(9,OUTPUT); // for 74HC4067-B
PCF8575_IN4.pinMode(10,OUTPUT); // for 74HC4067-C
PCF8575_IN4.pinMode(11,OUTPUT); // for 74HC4067-D
PCF8575_IN4.pinMode(12,OUTPUT); //LED-D7
PCF8575_IN4.pinMode(13,OUTPUT); //LED-D8
PCF8575_IN4.pinMode(14,INPUT); //Button-S3
PCF8575_IN4.pinMode(15,INPUT); //Button-S4
PCF8575_IN4.begin();
int p15Digital = PCF8575_IN4.digitalRead(15);
Serial.println(p15Digital);
More
Just like a well-organized workbench, this website uses cookies to function properly and efficiently.
🛠️ The Essentials (Necessary): Some cookies are categorized as necessary and are stored on your browser because they are critical for the basic working of the site.
📊 The Analytics (Third-party): We also use third-party cookies to help us analyze traffic and understand which projects you like the most. These are stored only if you give us the green light.
You can choose to opt-out, but keep in mind that disabling them might make the site experience a bit less "smooth".
| Cookie | Duration | Description |
|---|---|---|
| cookielawinfo-checkbox-analytics | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics". |
| cookielawinfo-checkbox-functional | 11 months | The cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional". |
| cookielawinfo-checkbox-necessary | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary". |
| cookielawinfo-checkbox-others | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other. |
| cookielawinfo-checkbox-performance | 11 months | This cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance". |
| viewed_cookie_policy | 11 months | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data. |
