Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Arduino code for KC868-A32 Pro]-02 read digital input by XL9535
#1
Code:
#include <PCA95x5.h>

PCA9555 ioex;

void setup() {
    Serial.begin(115200);
    delay(2000);

    Wire.begin(11,10,40000);
    ioex.attach(Wire,0x24);
    ioex.polarity(PCA95x5::Polarity::ORIGINAL_ALL);
    ioex.direction(PCA95x5::Direction::IN_ALL);
}

void loop() {
    Serial.println(ioex.read(), BIN);
    delay(1000);
}

source code download:

.zip   XL9535_input.zip (Size: 372 bytes / Downloads: 64)
before use XL9535 chip, you need to install PCA95x5 arduino library:
[Image: attachment.php?aid=5044]
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)