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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 5,374
» Latest member: zeth
» Forum threads: 2,575
» Forum posts: 13,317

Full Statistics

Online Users
There are currently 49 online users.
» 2 Member(s) | 32 Guest(s)
Amazonbot, Bytespider, Crawl, Google, PetalBot, Yandex, bot, owler, athxp, gal

Latest Threads
H32L - home assistant
Forum: KC868-HxB series Smart Controller
Last Post: athxp
2 minutes ago
» Replies: 0
» Views: 1
how to use AS ESP32-S3 vo...
Forum: KinCony AS
Last Post: biofects
18 minutes ago
» Replies: 14
» Views: 473
KC868-A2 configure yaml f...
Forum: KC868-A2
Last Post: elemarek
10 hours ago
» Replies: 15
» Views: 7,686
How can I power multiple ...
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
Today, 09:03 AM
» Replies: 12
» Views: 136
change wake up name
Forum: KinCony AS
Last Post: admin
Today, 02:10 AM
» Replies: 13
» Views: 107
Problem with IFTTT automa...
Forum: "KCS" firmware system
Last Post: admin
Yesterday, 11:41 PM
» Replies: 6
» Views: 54
A32 Pro ESPHome yaml incl...
Forum: KC868-A32/A32 Pro
Last Post: admin
Yesterday, 11:15 PM
» Replies: 18
» Views: 191
KC868-A2 ESP32 I/O pin de...
Forum: KC868-A2
Last Post: admin
Yesterday, 11:12 PM
» Replies: 8
» Views: 2,272
Need help with configurat...
Forum: KC868-HxB series Smart Controller
Last Post: admin
Yesterday, 04:32 AM
» Replies: 32
» Views: 400
ESP32 S3 set up issue
Forum: Extender module
Last Post: admin
12-17-2024, 11:43 PM
» Replies: 10
» Views: 73

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

[Arduino IDE demo source code for KC868-A8S]--#10-KC868-A8S_GSM_code

Code:
/*KC868-A8S GSM_CODE*/
/*The gsm module is SIM7600*/
/*Send the AT command*/

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

void loop() {
  while (Serial.available()) {
      delay(1);
      Serial1.write(Serial.read());
  }
  while (Serial1.available()) {
       Serial.write(Serial1.read());
  }
}

.zip   sim7600-AT-debug.zip (Size: 542 bytes / Downloads: 292)



Attached Files Thumbnail(s)
   

.zip   sscom32E.zip (Size: 344.42 KB / Downloads: 280)
Print this item

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: 283)
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: 265)
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: 265)
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: 253)
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: 248)
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: 252)
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: 252)
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: 254)
Print this item