Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Arduino demo source code for KC868-A4]-09 homekit work with 2 relay
#1
Heart 
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: 324)
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)