Uproszczenie dodanie info o podlaczaniu
This commit is contained in:
@@ -61,14 +61,10 @@ void setup() {
|
|||||||
homeSpan.setPairingCode("11122333");
|
homeSpan.setPairingCode("11122333");
|
||||||
homeSpan.setQRID("111-22-333");
|
homeSpan.setQRID("111-22-333");
|
||||||
|
|
||||||
homeSpan.begin(Category::Lighting,"HomeSpan LED");
|
// konfiguracja WIFI przez port szerefowy "W<returm"
|
||||||
|
|
||||||
new SpanAccessory();
|
homeSpan.begin(Category::Lighting,"HomeSpan LED tst");
|
||||||
|
|
||||||
new Service::AccessoryInformation();
|
|
||||||
new Characteristic::Identify();
|
|
||||||
|
|
||||||
new DEV_LED(16); // create an on/off LED attached to pin 16 (same as in Example 5)
|
|
||||||
|
|
||||||
new SpanAccessory();
|
new SpanAccessory();
|
||||||
|
|
||||||
|
|||||||
@@ -1,32 +1,3 @@
|
|||||||
|
|
||||||
////////////////////////////////////
|
|
||||||
// DEVICE-SPECIFIC LED SERVICES //
|
|
||||||
////////////////////////////////////
|
|
||||||
|
|
||||||
struct DEV_LED : Service::LightBulb { // ON/OFF LED
|
|
||||||
|
|
||||||
int ledPin; // pin number defined for this LED
|
|
||||||
SpanCharacteristic *power; // reference to the On Characteristic
|
|
||||||
|
|
||||||
DEV_LED(int ledPin) : Service::LightBulb(){ // constructor() method
|
|
||||||
|
|
||||||
power=new Characteristic::On();
|
|
||||||
this->ledPin=ledPin;
|
|
||||||
pinMode(ledPin,OUTPUT);
|
|
||||||
|
|
||||||
} // end constructor
|
|
||||||
|
|
||||||
boolean update(){ // update() method
|
|
||||||
|
|
||||||
digitalWrite(ledPin,power->getNewVal());
|
|
||||||
|
|
||||||
return(true); // return true
|
|
||||||
|
|
||||||
} // update
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
// Here's the new code defining DEV_DimmableLED - changes from above are noted in the comments
|
// Here's the new code defining DEV_DimmableLED - changes from above are noted in the comments
|
||||||
|
|
||||||
struct DEV_DimmableLED : Service::LightBulb { // Dimmable LED
|
struct DEV_DimmableLED : Service::LightBulb { // Dimmable LED
|
||||||
|
|||||||
Reference in New Issue
Block a user