POprawki pod siebie
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
#include "HomeSpan.h"
|
#include "HomeSpan.h"
|
||||||
#include "DEV_LED.h"
|
#include "DEV_LED.h"
|
||||||
|
int zmienna = 0;
|
||||||
void setup() {
|
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
|
// 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");
|
homeSpan.setQRID("111-22-333");
|
||||||
|
|
||||||
// konfiguracja WIFI przez port szerefowy "W<returm"
|
// konfiguracja WIFI przez port szerefowy "W<returm"
|
||||||
|
// 1.Płytka ESP32 Dev Module
|
||||||
|
// 2 Partycja: Minimal SPIFFS (1.9MB APP with OTA/190KB SPIFFS)
|
||||||
|
// 3. konfiguracja WIFI przez port szerefowy komenda "W", U - unpair
|
||||||
homeSpan.begin(Category::Lighting,"HomeSpan LED tst");
|
homeSpan.begin(Category::Lighting,"HomeSpan LED tst");
|
||||||
|
|
||||||
|
|
||||||
@@ -80,5 +82,6 @@ void setup() {
|
|||||||
void loop(){
|
void loop(){
|
||||||
|
|
||||||
homeSpan.poll();
|
homeSpan.poll();
|
||||||
|
Serial.println(zmienna);
|
||||||
|
delay(500);
|
||||||
} // end of loop()
|
} // end of loop()
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// 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
|
||||||
|
extern int zmienna;
|
||||||
|
|
||||||
struct DEV_DimmableLED : Service::LightBulb { // Dimmable LED
|
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=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)
|
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
|
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
|
} // 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.
|
// 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());
|
ledPin->set(power->getNewVal()*level->getNewVal());
|
||||||
|
zmienna = power->getNewVal()*level->getNewVal();
|
||||||
|
|
||||||
return(true); // return true
|
return(true); // return true
|
||||||
|
|
||||||
} // update
|
} // update
|
||||||
|
|||||||
Reference in New Issue
Block a user