Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 5,395
» Latest member: Dmitry razgulyaev
» Forum threads: 2,584
» Forum posts: 13,402

Full Statistics

Online Users
There are currently 60 online users.
» 0 Member(s) | 45 Guest(s)
Amazonbot, Bing, Bytespider, Crawl, Google, PetalBot, Yandex, bot

Latest Threads
H32L - home assistant
Forum: KC868-HxB series Smart Controller
Last Post: athxp
30 minutes ago
» Replies: 8
» Views: 40
KC868-H32B momentary swit...
Forum: KC868-HxB series Smart Controller
Last Post: stybyk
6 hours ago
» Replies: 2
» Views: 30
Manual Control Switches N...
Forum: KC868-E16S/E16P
Last Post: Can
6 hours ago
» Replies: 2
» Views: 7
How to control RGBW 5pin ...
Forum: KC868-A16
Last Post: MariusM
7 hours ago
» Replies: 12
» Views: 320
K868-A16 433 RF MHz recei...
Forum: KC868-A16
Last Post: MnM
8 hours ago
» Replies: 47
» Views: 49,791
KC868-A16 need to power c...
Forum: KC868-A series and Uair Smart Controller
Last Post: soulmf
8 hours ago
» Replies: 4
» Views: 20
change wake up name
Forum: KinCony AS
Last Post: gal
9 hours ago
» Replies: 24
» Views: 206
Problem with DS1307 on KC...
Forum: KC868-A6
Last Post: admin
9 hours ago
» Replies: 20
» Views: 485
KC868-A2 ESP32 I/O pin de...
Forum: KC868-A2
Last Post: admin
9 hours ago
» Replies: 12
» Views: 2,303
relay last state
Forum: DIY Project
Last Post: icemannz
Today, 07:46 AM
» Replies: 2
» Views: 29

Lightbulb [Arduino IDE demo source code for KC868-A8S]--#09-KC868-A8S_RS485_code
Posted by: KinCony Support - 06-01-2022, 01:23 AM - Forum: KC868-A8S - No Replies

[Arduino IDE demo source code for KC868-A8S]--#09-KC868-A8S_RS485_code

Code:
/*WWW.KINCONY.COM*/
/*KC868-A8s code of RS485 */
void setup() {

Serial2.begin(9600,SERIAL_8N1,32,33);  //  IO32   485RX   IO33 485TX

}

void loop() {
Serial2.println("KinCony ACBDEFG"); // Enter your print string
delay(1500);
}



Attached Files
.zip   rs485.zip (Size: 489 bytes / Downloads: 285)
Print this item

Lightbulb [Arduino IDE demo source code for KC868-A8S]--#08-KC868-A8S_WS2812-RGB_LED_code
Posted by: KinCony Support - 06-01-2022, 01:21 AM - Forum: KC868-A8S - No Replies

[Arduino IDE demo source code for KC868-A8S]--#08-KC868-A8S_WS2812-RGB_LED_code

Code:
/*KC868-A8S  WS2812 RGB LED CODE*/

#include <Adafruit_NeoPixel.h>

Adafruit_NeoPixel rgb_display = Adafruit_NeoPixel(130,12,NEO_GRB + NEO_KHZ800);
//The WS2812 rgb LED is connect to IO12    RGB_LED number is 1

void setup(){
  rgb_display.begin();
}

void loop(){
  /*
    void setPixelColor(uint16_t n, uint32_t c);
    uint16_t n   start from 0
*/
  rgb_display.setPixelColor((1)-1,(0xff00ff));// Set RGB_LED to Blue color
  rgb_display.setBrightness(100);
  rgb_display.show();
  delay(2000);
  rgb_display.setPixelColor((1)-1,(0xff0000));// Set RGB_LED to Blue color
  rgb_display.setBrightness(100);
  rgb_display.show();
  delay(2000);
  rgb_display.setPixelColor((1)-1,(0x00ff00));// Set RGB_LED to Blue color
  rgb_display.setBrightness(100);
  rgb_display.show();
  delay(2000);
 

}



Attached Files
.zip   WS2812-RGB_LED.zip (Size: 871 bytes / Downloads: 267)
Print this item

Lightbulb [Arduino IDE demo source code for KC868-A8S]--#07-KC868-A8S_PCF8574-Digital output_co
Posted by: KinCony Support - 06-01-2022, 01:20 AM - Forum: KC868-A8S - Replies (2)

[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: 299)
Print this item

Lightbulb [Arduino IDE demo source code for KC868-A8S]--#06-KC868-A8S_PCF8574-Digital input_cod
Posted by: KinCony Support - 06-01-2022, 01:19 AM - Forum: KC868-A8S - No Replies

[Arduino IDE demo source code for KC868-A8S]--#06-KC868-A8S_PCF8574-Digital input_code

Code:
/*KC868-A8S PCF8574 Digital input code*/
/*digital input will trigger digital output */
#include "Arduino.h"
#include "PCF8574.h"

// Set i2c address
PCF8574 pcf8574_IN1(0x22,4,5);
PCF8574 pcf8574_RE(0x24,4,5);
void setup()
{
    Serial.begin(115200);
    delay(1000);

pcf8574_RE.pinMode(P0, OUTPUT);
pcf8574_RE.pinMode(P1, OUTPUT);
pcf8574_RE.pinMode(P2, OUTPUT);
pcf8574_RE.pinMode(P3, OUTPUT);
pcf8574_RE.pinMode(P4, OUTPUT);
pcf8574_RE.pinMode(P5, OUTPUT);
pcf8574_RE.pinMode(P6, OUTPUT);
pcf8574_RE.pinMode(P7, OUTPUT);
pcf8574_RE.begin();
pcf8574_IN1.pinMode(P0, INPUT);
pcf8574_IN1.pinMode(P1, INPUT);
pcf8574_IN1.pinMode(P2, INPUT);
pcf8574_IN1.pinMode(P3, INPUT);
pcf8574_IN1.pinMode(P4, INPUT);
pcf8574_IN1.pinMode(P5, INPUT);
pcf8574_IN1.pinMode(P6, INPUT);
pcf8574_IN1.pinMode(P7, INPUT);
pcf8574_IN1.begin();

}

void loop()
{
uint8_t val1 = pcf8574_IN1.digitalRead(P0);
uint8_t val2 = pcf8574_IN1.digitalRead(P1);
uint8_t val3 = pcf8574_IN1.digitalRead(P2);
uint8_t val4 = pcf8574_IN1.digitalRead(P3);
uint8_t val5 = pcf8574_IN1.digitalRead(P4);
uint8_t val6 = pcf8574_IN1.digitalRead(P5);
uint8_t val7 = pcf8574_IN1.digitalRead(P6);
uint8_t val8 = pcf8574_IN1.digitalRead(P7);
if (val1==LOW) {
  pcf8574_RE.digitalWrite(P0,LOW);
  delay(100);
  }
else pcf8574_RE.digitalWrite(P0,HIGH);
if (val2==LOW) {
  pcf8574_RE.digitalWrite(P1,LOW);
  delay(100);
  }
else pcf8574_RE.digitalWrite(P1,HIGH);
if (val3==LOW)  {
  pcf8574_RE.digitalWrite(P2,LOW);
  delay(100);
  }
else pcf8574_RE.digitalWrite(P2,HIGH);
if (val4==LOW)  {
  pcf8574_RE.digitalWrite(P3,LOW);
  delay(100);
  }
else pcf8574_RE.digitalWrite(P3,HIGH);
if (val5==LOW)  {
  pcf8574_RE.digitalWrite(P4,LOW);
  delay(100);
  }
else pcf8574_RE.digitalWrite(P4,HIGH);
if (val6==LOW)  {
  pcf8574_RE.digitalWrite(P5,LOW);
  delay(100);
  }
else pcf8574_RE.digitalWrite(P5,HIGH);
if (val7==LOW)  {
  pcf8574_RE.digitalWrite(P6,LOW);
  delay(100);
  }
else pcf8574_RE.digitalWrite(P6,HIGH);
if (val8==LOW)  {
  pcf8574_RE.digitalWrite(P7,LOW);
  delay(100);
  }
else pcf8574_RE.digitalWrite(P7,HIGH);

    delay(300);
}



Attached Files
.zip   PCF8574-DI.zip (Size: 940 bytes / Downloads: 267)
Print this item

Lightbulb [Arduino IDE demo source code for KC868-A8S]--#05-KC868-A8S_LAN8720_UDP_code
Posted by: KinCony Support - 06-01-2022, 01:18 AM - Forum: KC868-A8S - No Replies

[Arduino IDE demo source code for KC868-A8S]--#05-KC868-A8S_LAN8720_UDP_code

Code:
/*KC868-A8S LAN8720_UDP communication code*/

#include <ETH.h>
#include <WiFiUdp.h>

#define ETH_ADDR        0
#define ETH_POWER_PIN  -1
#define ETH_MDC_PIN    23
#define ETH_MDIO_PIN   18   
#define ETH_TYPE       ETH_PHY_LAN8720
#define ETH_CLK_MODE   ETH_CLOCK_GPIO17_OUT

WiFiUDP Udp;                      //Create UDP object
unsigned int localUdpPort = 4196; //local port

/*Set the default IP address to 192.168.1.200  */
/*you can change the default IP address*/
IPAddress local_ip(192, 168, 1, 200);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress dns(192, 168, 1, 1);

void setup()
{
  Serial.begin(115200);
  Serial.println();
   
  ETH.begin(ETH_ADDR, ETH_POWER_PIN, ETH_MDC_PIN, ETH_MDIO_PIN, ETH_TYPE, ETH_CLK_MODE); //start with ETH

  // write confir for static IP, gateway,subnet,dns1,dns2
  if (ETH.config(local_ip, gateway, subnet, dns, dns) == false) {
    Serial.println("LAN8720 Configuration failed.");
  }else{Serial.println("LAN8720 Configuration success.");}
 
  Serial.println("Connected");
  Serial.print("IP Address:");
  Serial.println(ETH.localIP());

  Udp.begin(localUdpPort); //begin UDP listener
}

void loop()
{
  int packetSize = Udp.parsePacket(); //get package size
  if (packetSize)                     //if have received data
  {
    char buf[packetSize];
    Udp.read(buf, packetSize); //read current data

    Serial.println();
    Serial.print("Received: ");
    Serial.println(buf);
    Serial.print("From IP: ");
    Serial.println(Udp.remoteIP());
    Serial.print("From Port: ");
    Serial.println(Udp.remotePort());

    Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); //ready to send data
    Udp.print("Received: ");   
    Udp.write((const uint8_t*)buf, packetSize); //copy data to sender buffer
    Udp.endPacket();            //send data
  }
}



Attached Files
.zip   LAN8720_UDP.zip (Size: 1.09 KB / Downloads: 255)
Print this item

Lightbulb [Arduino IDE demo source code for KC868-A8S]--#04-KC868-A8S_DS18B20_code
Posted by: KinCony Support - 06-01-2022, 01:17 AM - Forum: KC868-A8S - No Replies

[Arduino IDE demo source code for KC868-A8S]--#04-KC868-A8S_DS18B20_code

Code:
/*KC868-A8S DS18B20 Temperature sensor code*/

#include <DS18B20.h>
DS18B20 ds1(14);  //channel-1-DS18b20  IO14


void setup()
{
  Serial.begin(115200);
}

void loop()
{
  Serial.print("Temperature1:");
  Serial.print(ds1.getTempC());
  Serial.print(" C /");
  delay(500);   
}



Attached Files
.zip   ds18b20.zip (Size: 498 bytes / Downloads: 251)
Print this item

Lightbulb [Arduino IDE demo source code for KC868-A8S]--#03-KC868-A8S_BEEP_code
Posted by: KinCony Support - 06-01-2022, 01:14 AM - Forum: KC868-A8S - No Replies

[Arduino IDE demo source code for KC868-A8S]--#03-KC868-A8S_BEEP_code

Code:
/*KC868-A8S Beep code*/

const int BEEP_Pin = 2; 

void setup() {

  // initialize the BEEP_Pin as an output:
   pinMode(BEEP_Pin, OUTPUT);
}

void loop() {
   
    digitalWrite(BEEP_Pin, LOW);
    delay(2000);
    digitalWrite(BEEP_Pin, HIGH);
    delay(2000);
}



Attached Files
.zip   Beep.zip (Size: 632 bytes / Downloads: 254)
Print this item

Lightbulb [Arduino IDE demo source code for KC868-A8S]--#02-KC868-A8S_ADC_INOUT_code
Posted by: KinCony Support - 06-01-2022, 01:12 AM - Forum: KC868-A8S - No Replies

[Arduino IDE demo source code for KC868-A8S]--#02-KC868-A8S_ADC_INOUT_code

Code:
/*KC868-A8S Analog input code*/
/*When the analog input interface has some Voltage ,it will print to the Serial port */
/*A1 A2   Input---0-5V*/
/*A3 A4   Input---0-20MA*/
#include "Arduino.h"

#define ANALOG_A1   36        // IO36 
#define ANALOG_A2   39        // IO39   
#define ANALOG_A3   34        // IO34  
#define ANALOG_A4   35        // IO35  
void setup()
{
    Serial.begin(115200);
    delay(1000);

  pinMode(ANALOG_A1,INPUT);
  pinMode(ANALOG_A2,INPUT);
  pinMode(ANALOG_A3,INPUT);
  pinMode(ANALOG_A4,INPUT);
}

void loop()
{
  if(analogRead(ANALOG_A1)!=0)
    {  Serial.printf("Current Reading A1 on Pin(%d)=%d\n",ANALOG_A1,analogRead(ANALOG_A1));delay(500);}
  if(analogRead(ANALOG_A2)!=0)
    {  Serial.printf("Current Reading A2 on Pin(%d)=%d\n",ANALOG_A2,analogRead(ANALOG_A2));delay(500);}
  if(analogRead(ANALOG_A3)!=0)
    {  Serial.printf("Current Reading A3 on Pin(%d)=%d\n",ANALOG_A3,analogRead(ANALOG_A3));delay(500);}
  if(analogRead(ANALOG_A4)!=0)
    {  Serial.printf("Current Reading A4 on Pin(%d)=%d\n",ANALOG_A4,analogRead(ANALOG_A4));delay(500);}

}



Attached Files
.zip   ADC_INOUT.zip (Size: 710 bytes / Downloads: 255)
Print this item

Lightbulb [Arduino IDE demo source code for KC868-A8S]--#01-KC868-A8S_433_receive_code
Posted by: KinCony Support - 06-01-2022, 01:11 AM - Forum: KC868-A8S - No Replies

[Arduino IDE demo source code for KC868-A8S]--#01-KC868-A8S_433_receive_code

Code:
/* RF-receive code for KC868-A8S*/
/*If receive the RF single,the LED will be turn the color to "0xff00ff"*/
/*install library RCSwitch and Adafruit_NeoPixel*/

#include <RCSwitch.h>  //Install library "rcswitch"
#include <Adafruit_NeoPixel.h>

Adafruit_NeoPixel rgb_display = Adafruit_NeoPixel(130,12,NEO_GRB + NEO_KHZ800);
//The WS2812 rgb LED is connect to IO12    RGB_LED number is 1
RCSwitch mySwitch = RCSwitch();
void setup() {
  Serial.begin(9600);
  rgb_display.begin();
  mySwitch.enableReceive(digitalPinToInterrupt(16));  //receive PIN IO16
}

void loop() {

if (mySwitch.available()) {
    Serial.print("Received ");
    Serial.println( mySwitch.getReceivedValue() );
    rgb_display.setPixelColor((1)-1,(0xff00ff));
    rgb_display.setBrightness(100);
    rgb_display.show();
  }
    mySwitch.resetAvailable();   
}
   



Attached Files
.zip   433-decode.zip (Size: 777 bytes / Downloads: 256)
Print this item

  KC868-A8 and PCF8574 Interrupt pin
Posted by: andhol - 05-31-2022, 07:53 PM - Forum: KC868-A8 - Replies (14)

Hi!
I am planning to use all 8 digital inputs of the KC868-A8, and it would be nice to be able to use the interrupt pin of the PCF8574 to detect changes. I'm just not sure if the pin is connected or not. When looking at the schematic, it looks like it is connected to GPIO16, but there is also a red X symbol next to it that might suggest otherwise.. Any hints? 

/A

Print this item