POprawki pod siebie

This commit is contained in:
sieja
2025-07-22 21:11:43 +02:00
parent 8ebd9377b1
commit c1809f9b91
2 changed files with 9 additions and 5 deletions

View File

@@ -1,4 +1,5 @@
// Here's the new code defining DEV_DimmableLED - changes from above are noted in the comments
extern int zmienna;
struct DEV_DimmableLED : Service::LightBulb { // Dimmable LED
@@ -12,7 +13,6 @@ struct DEV_DimmableLED : Service::LightBulb { // Dimmable LED
level=new Characteristic::Brightness(50); // NEW! Instantiate the Brightness Characteristic with an initial value of 50% (same as we did in Example 4)
level->setRange(5,100,1); // NEW! This sets the range of the Brightness to be from a min of 5%, to a max of 100%, in steps of 1% (different from Example 4 values)
this->ledPin=new LedPin(pin); // NEW! Configures a PWM LED for output to the specified pin. Note pinMode() does NOT need to be called in advance
} // end constructor
@@ -29,7 +29,8 @@ struct DEV_DimmableLED : Service::LightBulb { // Dimmable LED
// set the LED level to zero when the LightBulb is off, or to the current brightness level when it is on.
ledPin->set(power->getNewVal()*level->getNewVal());
zmienna = power->getNewVal()*level->getNewVal();
return(true); // return true
} // update