Code 8: //The demo code is homekit You can copy the code to your Arduino IDE.
homekit.zip (Size: 6.28 KB / Downloads: 324)
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();
}
homekit.zip (Size: 6.28 KB / Downloads: 324)