Smart Home Automation Forum
[Arduino demo source code for KC868-A4]-09 homekit work with 2 relay - Printable Version

+- Smart Home Automation Forum (https://www.kincony.com/forum)
+-- Forum: Technical Support (https://www.kincony.com/forum/forumdisplay.php?fid=20)
+--- Forum: KC868-A4 (https://www.kincony.com/forum/forumdisplay.php?fid=21)
+--- Thread: [Arduino demo source code for KC868-A4]-09 homekit work with 2 relay (/showthread.php?tid=1648)



[Arduino demo source code for KC868-A4]-09 homekit work with 2 relay - KinCony Support - 01-07-2022

Code 8: //The demo code is homekit    You can copy the code to your Arduino IDE.

Code:
#include "HomeSpan.h"
#include "DEV_LED.h"          // NEW! Include this new file, DEV_LED.h, which will be fully explained below

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

  homeSpan.begin(Category::Lighting,"HomeSpan LEDs");
 
  new SpanAccessory();
 
    new Service::AccessoryInformation();
      new Characteristic::Name("LED #1");
      new Characteristic::Manufacturer("HomeSpan");
      new Characteristic::SerialNumber("123-ABC");
      new Characteristic::Model("20mA LED");
      new Characteristic::FirmwareRevision("0.9");
      new Characteristic::Identify();           
     
    new Service::HAPProtocolInformation();     
      new Characteristic::Version("1.1.0");    

  new SpanAccessory();
 
    new Service::AccessoryInformation();   
      new Characteristic::Name("LED #2");   
      new Characteristic::Manufacturer("HomeSpan");
      new Characteristic::SerialNumber("123-ABC"); 
      new Characteristic::Model("20mA LED");  
      new Characteristic::FirmwareRevision("0.9"); 
      new Characteristic::Identify();              
     
    new Service::HAPProtocolInformation();         
      new Characteristic::Version("1.1.0");        
 
    new DEV_LED(15);                                  // ...and replaced with a single line that instantiates a second DEV_LED Service on Pin 17

}

void loop(){
 
  homeSpan.poll();
 
}

.zip   homekit.zip (Size: 6.28 KB / Downloads: 677)