Smart Home Automation Forum

Full Version: [Arduino code for KC868-A32 Pro]-02 read digital input by XL9535
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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:
[attachment=5046]
before use XL9535 chip, you need to install PCA95x5 arduino library:
[Image: attachment.php?aid=5044]