//
// FILE: pcf8575_test2.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo rotateLeft, -Right and toggleMask
// URL: https://github.com/RobTillaart/PCF8575
// addresses: 0x20 = 000
// 0x27 = 111
// 27/5/24: One PCF module working with 16 LEDs. Address are all low at 0x20.
// 29/5/24: module working, address changed to 111 0x27.
#include "PCF8575.h"
// adjust addresses if needed
//PCF8575 PCF(0x21); // add LEDs to lines (used as output)
//PCF8575 PCF(0x20); // address 0/0/0
// RP: does adding PCF8575 PCF1(0x22); give access to extra expander modules? 22/5/24
PCF8575 PCF1(0x27); // 1/1/1/
void setup()
{
Serial.begin(115200);
Serial.println(__FILE__);
Serial.print("PCF8575_LIB_VERSION:\t");
// Serial.println(PCF8575_LIB_VERSION);
Wire.begin();
PCF1.begin(); // RP
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
PCF1.write(0, 1); //RP - writes 16 bits, 1 at a time?
for (int i = 0; i < 15; i++)
{
PCF1.rotateLeft();
delay(50);
}
for (int i = 0; i < 15; i++)
{
PCF1.rotateRight();
delay(100);
}
for (int i = 0; i < 15; i++)
{
PCF1.rotateLeft(3);
delay(100);
}
for (int i = 0; i < 15; i++)
{
PCF1.rotateRight(2);
delay(100);
}
for (uint16_t i = 0; i < 65535; i += 253)
{
PCF1.toggleMask(i);
delay(100);
}
// 0010 0111 -> 0x27
// 1110 0100
PCF1.write16(0x2755);
for (int i = 0; i < 255; i++)
{
PCF1.reverse();
delay(100);
}
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
}
void loop()
{
}
// -- END OF FILE --