GY-63_MS5611/libraries/PCA9551/examples/PCA9551_blink/PCA9551_blink.ino
2023-12-11 10:38:24 +01:00

57 lines
941 B
C++

//
// FILE: PCA9551_blink.ino
// AUTHOR: Rob Tillaart
// DATE: 2023-07-18
// PURPOSE: test PCA9551 library
// URL: https://github.com/RobTillaart/PCA9551
//
// Connect LEDs from pin 0 and pin 1 with a resistor to 5V
// See datasheet
#include "Arduino.h"
#include "Wire.h"
#include "PCA9551.h"
PCA9551 leds(0x62);
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("PCA9551_LIB_VERSION: ");
Serial.println(PCA9551_LIB_VERSION);
Serial.println();
Wire.begin();
if (leds.begin() == false)
{
Serial.println("Could not connect.");
while (1);
}
// GPIO
// not mandatory, just to make it explicit
leds.pinMode(0, OUTPUT);
leds.pinMode(1, OUTPUT);
}
void loop()
{
leds.digitalWrite(0, LOW);
delay(500);
leds.digitalWrite(1, LOW);
delay(500);
leds.digitalWrite(0, HIGH);
delay(500);
leds.digitalWrite(1, HIGH);
delay(500);
}
// -- END OF FILE --