Message |
|
I'm stupid. With ioDeviceSync all OK
Yes, thanks. I think similar. But one more issue whitch I could understang. I have very "stuped" code just for some trainig: #include <IoAbstraction.h> #include <IoAbstractionWire.h> #include<TaskManagerIO.h> #include <Wire.h> MultiIoAbstractionRef multiIo = multiIoExpander(100); void setup() { Wire.begin(); Serial.begin(115200); Serial.println("Multi IoExpander example"); multiIoAddExpander(multiIo, ioFrom8574(0x20), 10); Serial.println("added an expander at pin 100 to 109"); // multiIoAddExpander(multiIo, ioFrom8574(0x21), 10); //Serial.println("added an expander at pin 110 to 119"); //ioDevicePinMode(multiIo, 100, INPUT); ioDevicePinMode(multiIo, 100, OUTPUT); ioDevicePinMode(multiIo, 101, OUTPUT); ioDevicePinMode(multiIo, 102, OUTPUT); ioDevicePinMode(multiIo, 103, OUTPUT); ioDevicePinMode(multiIo, 104, OUTPUT); ioDevicePinMode(multiIo, 105, OUTPUT); ioDevicePinMode(multiIo, 106, OUTPUT); ioDevicePinMode(multiIo, 107, OUTPUT); ioDevicePinMode(multiIo, LED_BUILTIN, OUTPUT); ioDeviceDigitalWrite(multiIo, 100, LOW); ioDeviceDigitalWrite(multiIo, 101, LOW); ioDeviceDigitalWrite(multiIo, 102, HIGH); ioDeviceDigitalWrite(multiIo, 103, HIGH); ioDeviceDigitalWrite(multiIo, 104, HIGH); ioDeviceDigitalWrite(multiIo, 105, HIGH); ioDeviceDigitalWrite(multiIo, 106, HIGH); ioDeviceDigitalWrite(multiIo, 107, HIGH); ioDeviceDigitalWrite(multiIo, LED_BUILTIN, HIGH); } void loop() { taskManager.runLoop(); } But nothing happens on PCF outputs, builtin led is OK. I tryed this too but no result: https://www.thecoderscorner.com/products/arduino-libraries/io-abstraction/i2c8574-example-ioabstraction-library/ expander outputs always High. I2C scanner show right adress of 8574 boad.
|
|
|
Hello, everyone!
I can't understand pin numbering using ioabstraction lib.
For example:
#include <IoAbstraction.h>
#include <IoAbstractionWire.h>
IoAbstractionRef ioExpander1;
IoAbstractionRef ioExpander2;
void setup() {
ioExpander1 = ioFrom8574(0x27);
ioExpander2 = ioFrom8574(0x28);
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
I set io to input using pinDirection(). If I want to read value from pin there is no problem. I can use ioDeviceDigitalRead with unit ref and pin number. I want to addSwitch() function witch only have "pin" parameter. And now I can't understand...? For example I want to addswitch to pin 3 ioExpander1 and to pin 5 ioExpander2. What pin numbers I should print in addSwitch() function?
|
|
|
|
|