Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Arduino IDE demo source code for KC868-A16]--#08-PCF8574-DO
#11
work well now?
Reply
#12
Hello, I have a KC868-A16 board, which I am new to. I want to use Arduino IDE because I know it. When connecting the KC868 board by USB-C to my PC (board powered or not powered with an external 12V power supply, is the same), nothing happens; I cannot see any Colm port with my Arduino IDE. So, please tell me how to connect the board and which board I should choose for my Arduino IDE. Thank you.
Reply
#13
take a photo how you wire of your KC868-A16.
in arduino IDE chose "NodeMCU-32S"
Reply
#14
Hi 

I have similar problem  
I can not turn on or off the relay.
my code : 
I use platform IO and framework  arduino

 #include "PCF8574.h"
#include <Wire.h>

#define Input_IIC_address 0x21
#define Input_IIC_address 0x22

#define Relay_IIC_address 0x24
#define Relay_IIC_address 0x25
GPIO_I2C gpioI2C;

// Set i2c address
PCF8574 pcf8574_input_1(Input_IIC_address,4,5);
PCF8574 pcf8574_input_2(Input_IIC_address,4,5);

PCF8574 pcf8574_relay_1(Relay_IIC_address,4,5);
PCF8574 pcf8574_relay_2(Relay_IIC_address,4,5);


void GPIO_I2C::Init()
{
#if ( PROFILE_COMPILE & GPIO_I2C_MODULE)

    PRINT_LOG_API_PrintDebug("Init()..", MODULE_NAME, __LINE__);
    byte count = 0;
    Wire.begin(4, 5);
  for (byte i = 8; i < 120; i++)
  {
    Wire.beginTransmission (i);          // Begin I2C transmission Address (i)
    if (Wire.endTransmission () == 0)  // Receive 0 = success (ACK response)
    {
      Serial.print ("Found address: ");
      Serial.print (i, DEC);
      Serial.print (" (0x");
      Serial.print (i, HEX);    // PCF8574 7 bit address
      Serial.println (")");
      break;
    }
  }


    //Wire.begin();  // Initialize I2C communication
  // Wire.setClock(100000); // Set I2C clock to 100kHz (default is 400kHz)

   

   

    pcf8574_relay_1.pinMode(P0, OUTPUT);
    pcf8574_relay_1.pinMode(P1, OUTPUT);
    pcf8574_relay_1.pinMode(P2, OUTPUT);
    pcf8574_relay_1.pinMode(P3, OUTPUT);
    pcf8574_relay_1.pinMode(P4, OUTPUT);
    pcf8574_relay_1.pinMode(P5, OUTPUT);
    pcf8574_relay_1.pinMode(P6, OUTPUT);
    pcf8574_relay_1.pinMode(P7, OUTPUT);

    pcf8574_relay_2.pinMode(P0, OUTPUT);
    pcf8574_relay_2.pinMode(P1, OUTPUT);
    pcf8574_relay_2.pinMode(P2, OUTPUT);
    pcf8574_relay_2.pinMode(P3, OUTPUT);
    pcf8574_relay_2.pinMode(P4, OUTPUT);
    pcf8574_relay_2.pinMode(P5, OUTPUT);
    pcf8574_relay_2.pinMode(P6, OUTPUT);
    pcf8574_relay_2.pinMode(P7, OUTPUT);

    pcf8574_input_1.pinMode(P0, INPUT);
    pcf8574_input_1.pinMode(P1, INPUT);
    pcf8574_input_1.pinMode(P2, INPUT);
    pcf8574_input_1.pinMode(P3, INPUT);
    pcf8574_input_1.pinMode(P4, INPUT);
    pcf8574_input_1.pinMode(P5, INPUT);
    pcf8574_input_1.pinMode(P6, INPUT);
    pcf8574_input_1.pinMode(P7, INPUT);

    pcf8574_input_2.pinMode(P0, INPUT);
    pcf8574_input_2.pinMode(P1, INPUT);
    pcf8574_input_2.pinMode(P2, INPUT);
    pcf8574_input_2.pinMode(P3, INPUT);
    pcf8574_input_2.pinMode(P4, INPUT);
    pcf8574_input_2.pinMode(P5, INPUT);
    pcf8574_input_2.pinMode(P6, INPUT);
    pcf8574_input_2.pinMode(P7, INPUT);

    if (pcf8574_relay_1.begin())
    {
        Serial.println("pcf8574_relay_1 OK");
    }
    else
    {
        Serial.println("pcf8574_relay_1 not OK");
    }

    Serial.print("Init pcf8574_2...");
    if (pcf8574_relay_2.begin())
    {
        Serial.println("pcf8574_relay_2 OK");
    }
    else
    {
        Serial.println("pcf8574_relay_2 NOT OK");
    }
}


void setup()
{
 
    gpioI2C.Init();

}

void loop()
{

    gpioI2C.TestOutputP1();   
}

Please help me to active these lines


Attached Files Image(s)
   
Reply
#15
because you have wrong wire. do you have the 9 bit green terminal, there are two point label "12V", you should connect with your power supply terminal.
Reply
#16
(01-08-2025, 12:30 PM)admin Wrote: because you have wrong wire. do you have the 9 bit green terminal, there are two point label "12V", you should connect with your power supply terminal.

can you take my image and edit it due to your answer ? I don't understand your answer
Reply
#17
let me know where t o connect wire
Reply
#18
see photo    
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)