GY-63_MS5611/libraries/PCA9552/examples/PCA9552_digitalRead/PCA9552_digitalRead.ino

55 lines
881 B
Arduino
Raw Normal View History

2023-07-20 10:33:34 -04:00
//
// FILE: PCA9552_digitalRead.ino
// AUTHOR: Rob Tillaart
// DATE: 2023-07-18
// PURPOSE: test PCA9552 library
// URL: https://github.com/RobTillaart/PCA9552
//
// Connect pin 0 to 4 to either +5V or to GND
// to read LOW/HIGH values
#include "PCA9552.h"
PCA9552 leds(0x62);
void setup()
{
Serial.begin(115200);
2023-12-11 04:41:06 -05:00
Serial.println(__FILE__);
2023-07-20 10:33:34 -04:00
Serial.print("PCA9552_LIB_VERSION: ");
Serial.println(PCA9552_LIB_VERSION);
Serial.println();
2023-12-11 04:41:06 -05:00
Wire.begin();
2023-07-20 10:33:34 -04:00
if (leds.begin() == false)
{
Serial.println("Could not connect.");
while (1);
}
for (int pin = 0; pin < leds.outputCount(); pin++)
{
2023-12-27 11:34:27 -05:00
leds.pinMode1(pin, INPUT);
2023-07-20 10:33:34 -04:00
}
}
void loop()
{
for (int pin = 0; pin < leds.outputCount(); pin++)
{
2023-12-27 11:34:27 -05:00
int x = leds.read1(pin);
2023-07-20 10:33:34 -04:00
Serial.print(x);
Serial.print('\t');
}
Serial.println();
delay(100);
}
// -- END OF FILE --