GY-63_MS5611/libraries/PCF8574/examples/PCF8574_test1/PCF8574_test1.ino

74 lines
1.2 KiB
Arduino
Raw Normal View History

2013-09-30 12:23:20 -04:00
//
// FILE: pcf8574_test.ino
// AUTHOR: Rob Tillaart
// DATE: 27-08-2013
//
2021-01-29 06:31:58 -05:00
// PUPROSE: demo
2013-09-30 12:23:20 -04:00
//
#include "PCF8574.h"
// adjust addresses if needed
PCF8574 PCF_38(0x38); // add switches to lines (used as input)
PCF8574 PCF_39(0x39); // add leds to lines (used as output)
void setup()
{
Serial.begin(115200);
2021-01-29 06:31:58 -05:00
Serial.println(__FILE__);
Serial.print("PCF8574_LIB_VERSION:\t");
Serial.println(PCF8574_LIB_VERSION);
PCF_38.begin();
PCF_39.begin();
2021-01-29 06:31:58 -05:00
2013-09-30 12:23:20 -04:00
uint8_t value = PCF_38.read8();
Serial.print("#38:\t");
Serial.println(value);
2021-01-29 06:31:58 -05:00
for (int i = 0; i < 255; i++)
2013-09-30 12:23:20 -04:00
{
PCF_39.write8(i);
delay(100);
}
2021-01-29 06:31:58 -05:00
2013-09-30 12:23:20 -04:00
PCF_39.write(0, 1);
2021-01-29 06:31:58 -05:00
for (int i = 0; i < 7; i++)
2013-09-30 12:23:20 -04:00
{
PCF_39.shiftLeft();
delay(100);
}
2021-01-29 06:31:58 -05:00
for (int i = 0; i < 7; i++)
2013-09-30 12:23:20 -04:00
{
PCF_39.shiftRight();
delay(100);
}
2021-01-29 06:31:58 -05:00
for (int i = 0; i < 8; i++)
2013-09-30 12:23:20 -04:00
{
PCF_39.write(i, 1);
delay(100);
PCF_39.write(i, 0);
delay(100);
}
2021-01-29 06:31:58 -05:00
for (int i = 0; i < 8; i++)
2013-09-30 12:23:20 -04:00
{
PCF_39.toggle(i);
delay(100);
PCF_39.toggle(i);
delay(100);
}
}
void loop()
{
// echos the lines
uint8_t value = PCF_38.read8();
PCF_39.write8(value);
delay(100);
}
2021-01-29 06:31:58 -05:00
2013-09-30 12:23:20 -04:00
// END OF FILE