Blynk example
Dependents: Blynk_Example_WIZwiki-W7500
Fork of Blynk by
Diff: WidgetLED.h
- Revision:
- 9:7369ec77a3ea
- Parent:
- 7:8879692d4e6c
diff -r a34aa310ec48 -r 7369ec77a3ea WidgetLED.h --- a/WidgetLED.h Wed Oct 12 10:38:37 2016 +0300 +++ b/WidgetLED.h Thu Jan 05 14:55:36 2017 +0200 @@ -10,33 +10,35 @@ #ifndef WidgetLED_h #define WidgetLED_h -#include <Blynk/BlynkApi.h> +#include <Blynk/BlynkWidgetBase.h> class WidgetLED + : public BlynkWidgetBase { public: - WidgetLED(uint8_t pin) : mPin(pin) {} - void setVPin(int vPin) { mPin = vPin; } + WidgetLED(uint8_t vPin) + : BlynkWidgetBase(vPin) + , mValue(0) + {} uint8_t getValue() const { return mValue; } void setValue(uint8_t value) { - mValue = value; + mValue = value; Blynk.virtualWrite(mPin, value); } void on() { - setValue(255); + setValue(255); } void off() { - setValue(0); + setValue(0); } private: - uint8_t mPin; uint8_t mValue; };