Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Arduino source code for KC868-1U]-06_OUTPUT
#1
[Arduino source code for KC868-1U]-06_OUTPUT
Code:
/*KC868-1U PCF8574 digital output code*/
#include "Arduino.h"
#include "PCF8574.h"

// Set i2c address
PCF8574 pcf8574_OUT1(0x24,4,16);


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

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


}

void loop()
{
  for(int i=0;i<=7;i++){
    pcf8574_OUT1.digitalWrite(i, LOW);
    delay(1000);
  }
  for(int i=0;i<=7;i++){
    pcf8574_OUT1.digitalWrite(i, HIGH);
    delay(1000);
  }
 
}
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)