Smart Home Automation Forum
A24 arduino demo source code-01-relay 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: KinCony A24 (https://www.kincony.com/forum/forumdisplay.php?fid=56)
+--- Thread: A24 arduino demo source code-01-relay output (/showthread.php?tid=3792)



A24 arduino demo source code-01-relay output - KinCony Support - 12-07-2023

Code:
#include "Arduino.h"
#include "PCF8575.h"
// Set i2c address
PCF8575 pcf8575_R1(0x21,16,5);
PCF8575 pcf8575_R2(0x22,16,5);
unsigned long timeElapsed;
void setup()
{
  Serial.begin(115200);
  Serial.println(__FILE__);
pcf8575_R1.pinMode(P0,OUTPUT);
pcf8575_R1.pinMode(P1,OUTPUT);
pcf8575_R1.pinMode(P2,OUTPUT);
pcf8575_R1.pinMode(P3,OUTPUT);
pcf8575_R1.pinMode(P4,OUTPUT);
pcf8575_R1.pinMode(P5,OUTPUT);
pcf8575_R1.pinMode(P6,OUTPUT);
pcf8575_R1.pinMode(P7,OUTPUT);
pcf8575_R1.pinMode(P8,OUTPUT);
pcf8575_R1.pinMode(P9,OUTPUT);
pcf8575_R1.pinMode(P10,OUTPUT);
pcf8575_R1.pinMode(P11,OUTPUT);
pcf8575_R2.pinMode(P0,OUTPUT);
pcf8575_R2.pinMode(P1,OUTPUT);
pcf8575_R2.pinMode(P2,OUTPUT);
pcf8575_R2.pinMode(P3,OUTPUT);
pcf8575_R2.pinMode(P4,OUTPUT);
pcf8575_R2.pinMode(P5,OUTPUT);
pcf8575_R2.pinMode(P6,OUTPUT);
pcf8575_R2.pinMode(P7,OUTPUT);
pcf8575_R2.pinMode(P8,OUTPUT);
pcf8575_R2.pinMode(P9,OUTPUT);
pcf8575_R2.pinMode(P10,OUTPUT);
pcf8575_R2.pinMode(P11,OUTPUT);
  pcf8575_R1.begin();
  pcf8575_R2.begin();
}
void loop()
{
pcf8575_R1.digitalWrite(P0,HIGH);delay(500);
pcf8575_R1.digitalWrite(P1,HIGH);delay(500);
pcf8575_R1.digitalWrite(P2,HIGH);delay(500);
pcf8575_R1.digitalWrite(P3,HIGH);delay(500);
pcf8575_R1.digitalWrite(P4,HIGH);delay(500);
pcf8575_R1.digitalWrite(P5,HIGH);delay(500);
pcf8575_R1.digitalWrite(P6,HIGH);delay(500);
pcf8575_R1.digitalWrite(P7,HIGH);delay(500);
pcf8575_R1.digitalWrite(P8,HIGH);delay(500);
pcf8575_R1.digitalWrite(P9,HIGH);delay(500);
pcf8575_R1.digitalWrite(P10,HIGH);delay(500);
pcf8575_R1.digitalWrite(P11,HIGH);delay(500);
pcf8575_R2.digitalWrite(P0,HIGH);delay(500);
pcf8575_R2.digitalWrite(P1,HIGH);delay(500);
pcf8575_R2.digitalWrite(P2,HIGH);delay(500);
pcf8575_R2.digitalWrite(P3,HIGH);delay(500);
pcf8575_R2.digitalWrite(P4,HIGH);delay(500);
pcf8575_R2.digitalWrite(P5,HIGH);delay(500);
pcf8575_R2.digitalWrite(P6,HIGH);delay(500);
pcf8575_R2.digitalWrite(P7,HIGH);delay(500);
pcf8575_R2.digitalWrite(P8,HIGH);delay(500);
pcf8575_R2.digitalWrite(P9,HIGH);delay(500);
pcf8575_R2.digitalWrite(P10,HIGH);delay(500);
pcf8575_R2.digitalWrite(P11,HIGH);delay(500);
pcf8575_R1.digitalWrite(P0,LOW);delay(500);
pcf8575_R1.digitalWrite(P1,LOW);delay(500);
pcf8575_R1.digitalWrite(P2,LOW);delay(500);
pcf8575_R1.digitalWrite(P3,LOW);delay(500);
pcf8575_R1.digitalWrite(P4,LOW);delay(500);
pcf8575_R1.digitalWrite(P5,LOW);delay(500);
pcf8575_R1.digitalWrite(P6,LOW);delay(500);
pcf8575_R1.digitalWrite(P7,LOW);delay(500);
pcf8575_R1.digitalWrite(P8,LOW);delay(500);
pcf8575_R1.digitalWrite(P9,LOW);delay(500);
pcf8575_R1.digitalWrite(P10,LOW);delay(500);
pcf8575_R1.digitalWrite(P11,LOW);delay(500);
pcf8575_R2.digitalWrite(P0,LOW);delay(500);
pcf8575_R2.digitalWrite(P1,LOW);delay(500);
pcf8575_R2.digitalWrite(P2,LOW);delay(500);
pcf8575_R2.digitalWrite(P3,LOW);delay(500);
pcf8575_R2.digitalWrite(P4,LOW);delay(500);
pcf8575_R2.digitalWrite(P5,LOW);delay(500);
pcf8575_R2.digitalWrite(P6,LOW);delay(500);
pcf8575_R2.digitalWrite(P7,LOW);delay(500);
pcf8575_R2.digitalWrite(P8,LOW);delay(500);
pcf8575_R2.digitalWrite(P9,LOW);delay(500);
pcf8575_R2.digitalWrite(P10,LOW);delay(500);
pcf8575_R2.digitalWrite(P11,LOW);delay(500);
}