- This topic has 0 replies, 1 voice, and was last updated 2 years, 4 months ago by .
Viewing 0 reply threads
Viewing 0 reply threads
- You must be logged in to reply to this topic.
Hi guys, I have a board with ESP32 and two PCF8574 expanders, one for inputs and the other one for outputs. The “output” ‘s ports are connected to an ULN2003 (darlington NPN amplifier) that is used to switch on relays. I did a simple program to test the board out. I can change the states of PCF_Output pins on a read input but the relays do not switch on. If I add an external pull up resistor 10k from VCC to a pin, the corresponding relay becomes controllable, but on startup its HIGH for about a second which is a problem. I am looking for a way to fix that. Any help is appreciated. Here is my sample test code:
void setup()
{
Serial.begin(115200);
PCF_Input.pinMode(P0, INPUT);
PCF_Input.pinMode(P1, INPUT);
PCF_Input.pinMode(P2, INPUT);
PCF_Input.pinMode(P3, INPUT);
PCF_Output.pinMode(P0, OUTPUT, LOW);
PCF_Output.pinMode(P1, OUTPUT, LOW);
PCF_Output.pinMode(P2, OUTPUT, LOW);
PCF_Output.pinMode(P3, OUTPUT, LOW);
PCF_Input.begin();
PCF_Output.begin();
}
void loop()
{
Serial.print(PCF_Output.digitalRead(P0));
Serial.print(PCF_Output.digitalRead(P1));
Serial.print(PCF_Output.digitalRead(P2));
Serial.print(PCF_Output.digitalRead(P3));
Serial.println();
delay(1000);
if(PCF_Input.digitalRead(P0)==LOW)
{
PCF_Output.digitalWrite(P0, HIGH);
PCF_Output.digitalWrite(P1, HIGH);
PCF_Output.digitalWrite(P2, HIGH);
PCF_Output.digitalWrite(P3, HIGH);
}
}
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. |
