Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Arduino IDE demo source code for KC868-A8S]--#07-KC868-A8S_PCF8574-Digital output_co
#1
Lightbulb 
[Arduino IDE demo source code for KC868-A8S]--#07-KC868-A8S_PCF8574-Digital output_code

Code:
/*KC868-A8S  PCF8574 Digital output code*/

#include "Arduino.h"
#include "PCF8574.h"

// Set i2c address
PCF8574 pcf8574(0x24,4,5);

void setup()
{
    Serial.begin(115200);
//    delay(1000);

    // Set pinMode to OUTPUT
  pcf8574.pinMode(P0, OUTPUT);
  pcf8574.pinMode(P1, OUTPUT);
  pcf8574.pinMode(P2, OUTPUT);
  pcf8574.pinMode(P3, OUTPUT);
  pcf8574.pinMode(P4, OUTPUT);
  pcf8574.pinMode(P5, OUTPUT);
  pcf8574.pinMode(P6, OUTPUT);
  pcf8574.pinMode(P7, OUTPUT);
   pcf8574.begin();
   
}

void loop()
{
   pcf8574.digitalWrite(P0, HIGH);  delay(300); 
   pcf8574.digitalWrite(P1, HIGH);  delay(300); 
   pcf8574.digitalWrite(P2, HIGH);  delay(300); 
   pcf8574.digitalWrite(P3, HIGH);  delay(300);
   pcf8574.digitalWrite(P4, HIGH);  delay(300); 
   pcf8574.digitalWrite(P5, HIGH);  delay(300);
   pcf8574.digitalWrite(P6, HIGH);  delay(300); 
   pcf8574.digitalWrite(P7, HIGH);  delay(300);
   pcf8574.digitalWrite(P0, LOW);   delay(300);
   pcf8574.digitalWrite(P1, LOW);   delay(300);
   pcf8574.digitalWrite(P2, LOW);   delay(300);
   pcf8574.digitalWrite(P3, LOW);   delay(300);
   pcf8574.digitalWrite(P4, LOW);   delay(300);
   pcf8574.digitalWrite(P5, LOW);   delay(300);
   pcf8574.digitalWrite(P6, LOW);   delay(300);
   pcf8574.digitalWrite(P7, LOW);   delay(300);

}


Attached Files
.zip   PCF8574-DO.zip (Size: 792 bytes / Downloads: 287)
Reply


Messages In This Thread
[Arduino IDE demo source code for KC868-A8S]--#07-KC868-A8S_PCF8574-Digital output_co - by KinCony Support - 06-01-2022, 01:20 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)