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

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 6,372
» Latest member: FnoXpert
» Forum threads: 2,845
» Forum posts: 15,039

Full Statistics

Online Users
There are currently 169 online users.
» 2 Member(s) | 150 Guest(s)
Amazonbot, Bing, Bytespider, Crawl, Google, PetalBot, WordPress/, Yandex, bot, owler, klakier2121, wchpikus

Latest Threads
[Arduino source code for ...
Forum: KC868-A2
Last Post: powerup
2 hours ago
» Replies: 5
» Views: 1,487
KinCony ESP32-S3 Core Boa...
Forum: Extender module
Last Post: admin
2 hours ago
» Replies: 37
» Views: 1,401
Using 12v on Digital Inpu...
Forum: KC868-A16
Last Post: admin
2 hours ago
» Replies: 13
» Views: 366
[Arduino IDE demo source ...
Forum: KC868-A16
Last Post: admin
2 hours ago
» Replies: 8
» Views: 2,587
Curtain/Window Shade Cont...
Forum: Suggestions and feedback on KinCony's products
Last Post: admin
2 hours ago
» Replies: 1
» Views: 2
Pull up on A8
Forum: KC868-A series and Uair Smart Controller
Last Post: heffneil
5 hours ago
» Replies: 17
» Views: 241
A16: IFTTT Time based act...
Forum: KC868-A16
Last Post: sebfromgermany
Yesterday, 01:20 PM
» Replies: 17
» Views: 164
analog input resolution 3...
Forum: KC868-A16
Last Post: Yosemite
Yesterday, 12:43 PM
» Replies: 15
» Views: 388
KC868-HA-V21 serial port ...
Forum: KC868-HA /HA v2
Last Post: admin
Yesterday, 10:15 AM
» Replies: 8
» Views: 99
Using B16M for driving LE...
Forum: B16M
Last Post: admin
Yesterday, 10:11 AM
» Replies: 3
» Views: 11

  [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: 474)

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: 320)

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

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

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: 507)

Print this item

  KC868-1U configure yaml for ESPhome Home assistant
Posted by: admin - 06-21-2023, 01:23 AM - Forum: KC868-1U - No Replies

   

.txt   KC868-1U-ha-config.txt (Size: 5.76 KB / Downloads: 191)

esphome:
  name: 1u
  platform: ESP32
  board: esp32dev
 
 
remote_receiver:
  pin: 13
  dump:
    - rc_switch
  tolerance: 50%
  filter: 250us
  idle: 2ms
  buffer_size: 2kb
# Example configuration entry for ESP32
i2c:
  sda: 4
  scl: 16
  scan: true
  id: bus_a
# Example configuration entry
ethernet:
  type: LAN8720
  mdc_pin: GPIO23
  mdio_pin: GPIO18
  clk_mode: GPIO17_OUT
  phy_addr: 0
  # Optional manual IP
 # manual_ip:
 #   static_ip: 192.168.1.199
#    gateway: 192.168.1.1
#    subnet: 255.255.255.0  
# Example configuration entry
pcf8574:
  - id: 'pcf8574_hub_out_1'  # for output channel 1-8
    address: 0x24
  - id: 'pcf8574_hub_in_1'  # for input channel 1-8
    address: 0x22
# Individual outputs
switch:
  - platform: gpio
    name: "light1"
    id: light1
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 0
      mode: OUTPUT
      inverted: true
  - platform: gpio
    name: "light2"
    id: light2
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 1
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "light3"
    id: light3
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 2
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "light4"
    id: light4
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 3
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "light5"
    id: light5
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 4
      mode: OUTPUT
      inverted: true      
     
  - platform: gpio
    name: "light6"
    id: light6
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 5
      mode: OUTPUT
      inverted: true
     
  - platform: gpio
    name: "light7"
    id: light7
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 6
      mode: OUTPUT
      inverted: true
  - platform: gpio
    name: "light8"
    id: light8
    pin:
      pcf8574: pcf8574_hub_out_1
      number: 7
      mode: OUTPUT
      inverted: true
binary_sensor:
  - platform: gpio
    name: "input1"
    on_press:
      then:
        - switch.toggle: light1
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 0
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "input2"
    on_press:
      then:
        - switch.toggle: light2
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 1
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "input3"
    on_press:
      then:
        - switch.toggle: light3
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 2
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "input4"
    on_press:
      then:
        - switch.toggle: light4
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 3
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "input5"
    on_press:
      then:
        - switch.toggle: light5
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 4
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "input6"
    on_press:
      then:
        - switch.toggle: light6
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 5
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "input7"
    on_press:
      then:
        - switch.toggle: light7
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 6
      mode: INPUT
      inverted: true
  - platform: gpio
    name: "input8"
    on_press:
      then:
        - switch.toggle: light8
    pin:
      pcf8574: pcf8574_hub_in_1
      number: 7
      mode: INPUT
      inverted: true
  - platform: remote_receiver
    name: "remoter1"
    rc_switch_raw:
      code: '001111010111001010111000'
      protocol: 1
    on_press:
      then:
        - switch.toggle: light1
    filters:
      - delayed_off: 200ms
  - platform: remote_receiver
    name: "remoter2"
    rc_switch_raw:
      code: '001111010111001010111100'
      protocol: 1
    on_press:
      then:
        - switch.toggle: light2
    filters:
      - delayed_off: 200ms
     
  - platform: remote_receiver
    name: "remoter3"
    rc_switch_raw:
      code: '001111010111001010110100'
      protocol: 1
    on_press:
      then:
        - switch.toggle: light3
    filters:
      - delayed_off: 200ms
     
  - platform: remote_receiver
    name: "remoter4"
    rc_switch_raw:
      code: '001111010111001010111001'
      protocol: 1
    on_press:
      then:
        - switch.toggle: light4
    filters:
      - delayed_off: 200ms  
   
  - platform: remote_receiver
    name: "remoter5"
    rc_switch_raw:
      code: '001111010111001010110010'
      protocol: 1
    on_press:
      then:
        - switch.toggle: light5
    filters:
      - delayed_off: 200ms
  - platform: remote_receiver
    name: "remoter6"
    rc_switch_raw:
      code: '001111010111001010110101'
      protocol: 1
    on_press:
      then:
        - switch.toggle: light6
    filters:
      - delayed_off: 200ms
     
  - platform: remote_receiver
    name: "remoter7"
    rc_switch_raw:
      code: '001111010111001010110001'
      protocol: 1
    on_press:
      then:
        - switch.toggle: light7
    filters:
      - delayed_off: 200ms
     
  - platform: remote_receiver
    name: "remoter8"
    rc_switch_raw:
      code: '001111010111001010110011'
      protocol: 1
    on_press:
      then:
        - switch.toggle: light8
    filters:
      - delayed_off: 200ms
     
# Enable logging
logger:
# Enable Home Assistant API
api:
dallas:
  - pin: 14
    update_interval: 5s
sensor:
  - platform: dallas
    address: 0xa538cee908646128
    name: "1U Temperature"

Print this item