blynk & neopixelring & w7500

Fork of WIZwiki-7500_Blynk by IOP

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers WidgetLED.h Source File

WidgetLED.h

Go to the documentation of this file.
00001 /**
00002  * @file       WidgetLED.h
00003  * @author     Volodymyr Shymanskyy
00004  * @license    This project is released under the MIT License (MIT)
00005  * @copyright  Copyright (c) 2015 Volodymyr Shymanskyy
00006  * @date       Apr 2015
00007  * @brief
00008  */
00009 
00010 #ifndef WidgetLED_h
00011 #define WidgetLED_h
00012 
00013 #include <Blynk/BlynkWidgetBase.h >
00014 
00015 class WidgetLED
00016     : public BlynkWidgetBase
00017 {
00018 public:
00019     WidgetLED(uint8_t vPin)
00020         : BlynkWidgetBase(vPin)
00021         , mValue(0)
00022     {}
00023 
00024     uint8_t getValue() const {
00025         return mValue;
00026     }
00027 
00028     void setValue(uint8_t value) {
00029         mValue = value;
00030         Blynk.virtualWrite(mPin, value);
00031     }
00032 
00033     void on() {
00034         setValue(255);
00035     }
00036 
00037     void off() {
00038         setValue(0);
00039     }
00040 
00041 private:
00042     uint8_t mValue;
00043 };
00044 
00045 #endif