We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c166be1 commit 46dcd23Copy full SHA for 46dcd23
MultiPlexer_PCF8574/MultiPlexer_PCF8574.cpp
@@ -9,15 +9,22 @@ MultiPlexer_PCF8574::MultiPlexer_PCF8574(uint8_t address) {
9
}
10
11
void MultiPlexer_PCF8574::begin() {
12
- for (int i=0; i<8; i++) {
+ Serial.print("Initializing PCF8574... ");
13
+ // inputs
14
+ int i = 0;
15
+ for (i = 0; i<4; i++) {
16
_expander->pinMode(i, INPUT);
17
18
+ // outputs
19
+ for (i=4; i<8; i++) {
20
+ _expander->pinMode(i, OUTPUT, LOW);
21
+ }
22
- if (_expander->begin()) {
- Serial.println("OK");
- } else{
- Serial.println("KO");
- }
23
+ if (_expander->begin()) {
24
+ Serial.println("OK");
25
+ } else{
26
+ Serial.println("Error!");
27
28
29
30
void MultiPlexer_PCF8574::loop() {
0 commit comments