0

There is an IO expander PCA9534PW, Arduino UNO. I don’t really understand how I can manage this expander using UNO over I2C.

I found an example, but here is the reading mode.

What I need: Set the IO0 pin to exit mode, set the HIGH / LOW level to IO0.

In the datasheet, I just realized that to enter the settings mode - you need to write Wire.write(0x03). How can I do it?

asked Mar 11, 2019 at 8:04
2

1 Answer 1

2

You set the pin mode by setting the configuration register.

Wire.beginTransmission(0x20);
Wire.write(0x03); // Configuration Register
Wire.write(0xfe); // IO7-IO1 Input, IO0 Output
Wire.endTransmission();

Then write the output port register with HIGH and LOW.

Wire.beginTransmission(0x20);
Wire.write(0x01); // Output Port Register
Wire.write(0x01); // IO0 HIGH
Wire.endTransmission();
delay(500);
Wire.beginTransmission(0x20);
Wire.write(0x01); // Output Port Register
Wire.write(0x00); // IO0 LOW
Wire.endTransmission();

But using a library is much easier. See, for instance, https://github.com/alotaiba/PCA9534.

answered Mar 11, 2019 at 10:28
2

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.