Uproszczenie dodanie info o podlaczaniu

This commit is contained in:
sieja
2025-07-22 16:18:09 +02:00
parent f650e12e80
commit 3fb41c25d4
2 changed files with 3 additions and 36 deletions

View File

@@ -61,14 +61,10 @@ void setup() {
homeSpan.setPairingCode("11122333");
homeSpan.setQRID("111-22-333");
homeSpan.begin(Category::Lighting,"HomeSpan LED");
new SpanAccessory();
new Service::AccessoryInformation();
new Characteristic::Identify();
// konfiguracja WIFI przez port szerefowy "W<returm"
new DEV_LED(16); // create an on/off LED attached to pin 16 (same as in Example 5)
homeSpan.begin(Category::Lighting,"HomeSpan LED tst");
new SpanAccessory();

View File

@@ -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
struct DEV_DimmableLED : Service::LightBulb { // Dimmable LED