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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 5,375
» Latest member: tziku
» Forum threads: 2,575
» Forum posts: 13,319

Full Statistics

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

Latest Threads
Problem with IFTTT automa...
Forum: "KCS" firmware system
Last Post: Poczwara13
1 hour ago
» Replies: 7
» Views: 64
change wake up name
Forum: KinCony AS
Last Post: gal
1 hour ago
» Replies: 14
» Views: 109
H32L - home assistant
Forum: KC868-HxB series Smart Controller
Last Post: athxp
1 hour ago
» Replies: 0
» Views: 2
how to use AS ESP32-S3 vo...
Forum: KinCony AS
Last Post: biofects
1 hour ago
» Replies: 14
» Views: 473
KC868-A2 configure yaml f...
Forum: KC868-A2
Last Post: elemarek
Today, 10:12 AM
» Replies: 15
» Views: 7,687
How can I power multiple ...
Forum: KC868-A series and Uair Smart Controller
Last Post: admin
Today, 09:03 AM
» Replies: 12
» Views: 137
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,273
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

  [Arduino source code for KC868-1U]-06_OUTPUT
Posted by: KinCony Support - 06-21-2023, 05:22 AM - Forum: KC868-1U - No Replies

[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);
  }
 
}

Print this item

  [Arduino source code for KC868-1U]-05_LAN8720_UDP
Posted by: KinCony Support - 06-21-2023, 05:21 AM - Forum: KC868-1U - No Replies

[Arduino source code for KC868-1U]-05_LAN8720_UDP

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 it based on the IP address of the router
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.");}
 
/* while(!((uint32_t)ETH.localIP())) //wait for IP
  {

  }*/
  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
  }
}

Print this item

  [Arduino source code for KC868-1U]-04_IR_send_code
Posted by: KinCony Support - 06-21-2023, 05:19 AM - Forum: KC868-1U - No Replies

[Arduino source code for KC868-1U]-04_IR_send_code

Code:
/*if download key pressed  send IR signal*/
#include <IRremote.h>
IRsend irsend(5);     
uint8_t sRepeats = 0;

void setup() {

  Serial.begin(115200);
  pinMode(0,INPUT);
  IrSender.begin(5,0);
  IrSender.enableIROut(38);
}

void loop() {
    
        Serial.println("Turn on LED");
        irsend.sendNECRaw(0xF807FF00, sRepeats);   //  0xF807FF00  is the raw_code  of led on
        delay(1000);
        Serial.println("Turn off LED");
        irsend.sendNECRaw(0xF906FF00, sRepeats);  //   0xF906FF00 is the raw_code  of led Off
       
}  

Print this item

  [Arduino source code for KC868-1U]-03_IR_receive_code
Posted by: KinCony Support - 06-21-2023, 05:19 AM - Forum: KC868-1U - No Replies

[Arduino source code for KC868-1U]-03_IR_receive_code

Code:
/*KC868-1U IR receive code*/
#include <IRremote.h>
IRrecv irrecv (15);
void setup() {

  Serial.begin(115200);
  irrecv.enableIRIn();
}

void loop() {
    if (irrecv.decode()) {
      Serial.print("irCode address: ");           
        Serial.println(irrecv.decodedIRData.address,HEX);
        Serial.print("irCode command: ");           
        Serial.println(irrecv.decodedIRData.command,HEX);
        Serial.print("irCode decodedRawData: ");           
        Serial.println(irrecv.decodedIRData.decodedRawData,HEX);
        Serial.println();
        //delay(1000);
    }
      IrReceiver.resume();
}

Print this item

  [Arduino source code for KC868-1U]-02_INPUT
Posted by: KinCony Support - 06-21-2023, 05:19 AM - Forum: KC868-1U - No Replies

[Arduino source code for KC868-1U]-02_INPUT

Code:
/*KC868-1U Digital input code*/
#include "Arduino.h"
#include "PCF8574.h"

// Set i2c address
PCF8574 pcf8574_IN1(0x22,4,16);

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

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) Serial.println("KEY1 PRESSED");
if (val2==LOW) Serial.println("KEY2 PRESSED");
if (val3==LOW) Serial.println("KEY3 PRESSED");
if (val4==LOW) Serial.println("KEY4 PRESSED");
if (val5==LOW) Serial.println("KEY5 PRESSED");
if (val6==LOW) Serial.println("KEY6 PRESSED");
if (val7==LOW) Serial.println("KEY7 PRESSED");
if (val8==LOW) Serial.println("KEY8 PRESSED");

    delay(300);
}

Print this item

  [Arduino source code for KC868-1U]-01_DS18B20
Posted by: KinCony Support - 06-21-2023, 05:19 AM - Forum: KC868-1U - No Replies

[Arduino source code for KC868-1U]-01_DS18B20

Code:
#include <DS18B20.h>

DS18B20 ds1(14); 
void setup() {
  Serial.begin(115200);

}
void loop() {
      Serial.printf("Tem1 is %.2f C \n ",ds1.getTempC());
}

Print this item

  Node-Red demo for Server-Mini use by RELAY and INPUT
Posted by: admin - 06-21-2023, 04:07 AM - Forum: KinCony Server-Mini / Server-16 Raspberry Pi4 relay module - Replies (2)

   
   
   
   

Node-Red json file download:

.zip   KinCony_Server_Mini.zip (Size: 2.84 KB / Downloads: 439)

Print this item

  SERVER-MINI PCB python test code
Posted by: admin - 06-21-2023, 01:52 AM - Forum: KinCony Server-Mini / Server-16 Raspberry Pi4 relay module - Replies (7)

these python code use for test KinCony Server-Mini PCB hardware. you can test it locally or use remote login by putty tool. before test, install Raspberry Pi OS on SD card or eMMC (if your CM4 with eMMC)

.pdf   SERVER-MINI_test_python_code .pdf (Size: 1 MB / Downloads: 260)

.zip   putty-64bit-0.79-pre20230504-installer.zip (Size: 3.08 MB / Downloads: 402)

.zip   rpiboot_setup.zip (Size: 9.9 MB / Downloads: 196)

Print this item

  SERVER-MINI Raspberry Pi CM4 GPIO pins define
Posted by: admin - 06-21-2023, 01:27 AM - Forum: KinCony Server-Mini / Server-16 Raspberry Pi4 relay module - Replies (1)

   

Print this item

  Server-Mini hardware interface and resource
Posted by: admin - 06-21-2023, 01:26 AM - Forum: KinCony Server-Mini / Server-16 Raspberry Pi4 relay module - Replies (6)


.pdf   KinCony Server-Mini.pdf (Size: 12.97 MB / Downloads: 440)

Print this item