Smart Home Automation Forum
[Arduino source code for KC868-A8M]-05 OUTPUT - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-A8M (https://www.kincony.com/forum/forumdisplay.php?fid=48)
+--- Thread: [Arduino source code for KC868-A8M]-05 OUTPUT (/showthread.php?tid=2802)



[Arduino source code for KC868-A8M]-05 OUTPUT - KinCony Support - 04-14-2023

Code:
#include "Arduino.h"
#include "PCF8574.h"

#define SDA 5
#define SCL 4

PCF8574 pcf8574_RE1(0x24,SDA,SCL);//DO
void setup()
{
    Serial.begin(115200);
for(int i=0;i<=7;i++)
{
   pcf8574_RE1.pinMode(i, OUTPUT);
}
   pcf8574_RE1.begin();

for(int i=0;i<=7;i++)
{
  pcf8574_RE1.digitalWrite(i, LOW);delay(200);
}
for(int i=0;i<=7;i++)
{
  pcf8574_RE1.digitalWrite(i, HIGH);delay(200);
}   
}

void loop()
{
  /******Output is all off by default, and can be turned
on or off manually when pressed by the keypad**************/
for(int i=0;i<=7;i++)
{
  pcf8574_RE1.digitalWrite(i, HIGH);delay(100);
}

}
[Arduino source code for KC868-A8M]-05 OUTPUT