GY-63_MS5611/libraries/PCA9551/examples/PCA9551_test02/PCA9551_test02.ino

52 lines
816 B
Arduino
Raw Normal View History

2023-07-20 10:35:33 -04:00
//
// FILE: PCA9551_test02.ino
// AUTHOR: Rob Tillaart
// DATE: 2023-07-17
// PURPOSE: test PCA9551 library
// URL: https://github.com/RobTillaart/PCA9551
#include "Arduino.h"
#include "Wire.h"
#include "PCA9551.h"
PCA9551 leds(0x62);
void setup()
{
Serial.begin(115200);
2023-12-11 04:38:24 -05:00
Serial.println(__FILE__);
2023-07-20 10:35:33 -04:00
Serial.print("PCA9551_LIB_VERSION: ");
Serial.println(PCA9551_LIB_VERSION);
Serial.println();
2023-12-11 04:38:24 -05:00
Wire.begin();
2023-07-20 10:35:33 -04:00
if (leds.begin() == false)
{
Serial.println("Could not connect.");
while(1);
}
}
void loop()
{
// random blink
leds.digitalWrite(0, random(2));
// steady blink
leds.digitalWrite(1, !leds.digitalRead(1));
// output 2 follows 3
leds.digitalWrite(2, leds.digitalRead(3));
leds.digitalWrite(3, random(2));
delay(1000);
}
// -- END OF FILE --