diff --git a/ESP32/06-DimmableLED/06-DimmableLED.ino b/ESP32/06-DimmableLED/06-DimmableLED.ino index 5bad2b0..ed87ac8 100644 --- a/ESP32/06-DimmableLED/06-DimmableLED.ino +++ b/ESP32/06-DimmableLED/06-DimmableLED.ino @@ -39,7 +39,7 @@ #include "HomeSpan.h" #include "DEV_LED.h" - +int zmienna = 0; void setup() { // Example 6 changes Example 5 so that LED #2 is now dimmable, instead of just on/off. This requires us to create a new @@ -62,7 +62,9 @@ void setup() { homeSpan.setQRID("111-22-333"); // konfiguracja WIFI przez port szerefowy "WsetRange(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