enable having two led channels
This commit is contained in:
parent
1526ae98bd
commit
7169be9882
@ -5,14 +5,16 @@
|
||||
|
||||
class DeviceLed : public Device {
|
||||
public:
|
||||
inline DeviceLed(byte ledPin) {
|
||||
inline DeviceLed(byte ledPin, char* ledName):ledNode(ledName, "led") {
|
||||
pinLed = ledPin;
|
||||
nameLed = ledName;
|
||||
}
|
||||
virtual void deviceSetup();
|
||||
virtual void deviceRegister();
|
||||
virtual void deviceLoop();
|
||||
private:
|
||||
byte pinLed;
|
||||
char* nameLed;
|
||||
int brightness = 0;
|
||||
bool fading = false;
|
||||
int fade_from, fade_to;
|
||||
@ -24,5 +26,5 @@ class DeviceLed : public Device {
|
||||
bool ledOnHandler(String value);
|
||||
bool ledBrightnessHandler(String message);
|
||||
bool ledFadeHandler(String message);
|
||||
HomieNode ledNode{"led", "led"};
|
||||
HomieNode ledNode;
|
||||
};
|
||||
|
@ -13,8 +13,10 @@
|
||||
|
||||
const char* FWNAME = "things@H801wifi";
|
||||
|
||||
const byte PIN_LED = 14;
|
||||
DeviceLed deviceLed(PIN_LED);
|
||||
const byte PIN_LED1 = 14;
|
||||
const byte PIN_LED2 = 4;
|
||||
DeviceLed deviceLedW1(PIN_LED1, "white1");
|
||||
DeviceLed deviceLedW2(PIN_LED2, "white2");
|
||||
|
||||
const byte PIN_RGB_RED = 15;
|
||||
const byte PIN_RGB_GREEN = 13;
|
||||
@ -22,6 +24,7 @@ const byte PIN_RGB_BLUE = 12;
|
||||
DeviceRgb deviceRgb(PIN_RGB_RED, PIN_RGB_GREEN, PIN_RGB_BLUE);
|
||||
|
||||
Device* devices[] = {
|
||||
&deviceLed,
|
||||
&deviceLedW1,
|
||||
&deviceLedW2,
|
||||
&deviceRgb,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user