Blynk library for embedded hardware. Works with Arduino, ESP8266, Raspberry Pi, Intel Edison/Galileo, LinkIt ONE, Particle Core/Photon, Energia, ARM mbed, etc. http://www.blynk.cc/
Dependents: Blynk_RBL_BLE_Nano Blynk_MicroBit Blynk_Serial Blynk_RBL_BLE_Nano
Diff: WidgetLED.h
- Revision:
- 9:7369ec77a3ea
- Parent:
- 7:8879692d4e6c
--- 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; };