GY-63_MS5611/libraries/TCA9555/examples/TCA9555_setPolarity/TCA9555_setPolarity.ino

58 lines
1.0 KiB
Arduino
Raw Normal View History

2021-06-11 04:31:59 -04:00
//
// FILE: TCA9555_setPolarity.ino
// AUTHOR: Rob Tillaart
/// DATE: 2021-06-09
// PUPROSE: test TCA9555 library
#include "TCA9555.h"
#include "Wire.h"
TCA9555 TCA(0x27);
void setup()
{
Serial.begin(115200);
Serial.print("TCA9555_LIB_VERSION: ");
Serial.println(TCA9555_LIB_VERSION);
Wire.begin();
TCA.begin();
Serial.println("TEST digitalRead(pin)");
for (int pin = 0; pin < 16; pin++)
{
int val = TCA.digitalRead(pin);
Serial.print(val);
Serial.print(' ');
}
Serial.println();
Serial.println("\nchange polarity");
Serial.println(TCA.getPolarity8(0));
Serial.println(TCA.getPolarity8(1));
TCA.setPolarity8(0, 0xFF); // all inverted
TCA.setPolarity8(1, 0xFF); // all inverted
Serial.println(TCA.getPolarity8(0));
Serial.println(TCA.getPolarity8(1));
Serial.println("\nafter setPolarity");
for (int pin = 0; pin < 16; pin++)
{
int val = TCA.digitalRead(pin);
Serial.print(val);
Serial.print(' ');
}
Serial.println();
}
2021-12-28 12:38:10 -05:00
2021-06-11 04:31:59 -04:00
void loop()
{
}
// -- END OF FILE --
2021-12-28 12:38:10 -05:00