52 lines
1.1 KiB
C++
52 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <ESP8266WiFi.h>
|
|
#include <IRremoteESP8266.h>
|
|
#include <IRsend.h>
|
|
#include <HALightColorTemperatureBrightness.hpp>
|
|
|
|
class IRLight: public HALightColorTemperatureBrightnessController {
|
|
private:
|
|
bool state;
|
|
short brightness;
|
|
byte color_temp;
|
|
|
|
IRsend *irsend;
|
|
|
|
const uint32_t RDOn = irsend->encodeNEC(0x80, 0x1);
|
|
|
|
const uint32_t RDOff = irsend->encodeNEC(0x80, 0x1A);
|
|
|
|
const uint32_t RDButtonCenter = irsend->encodeNEC(0x80, 0x5);
|
|
|
|
const uint32_t RDBrightnessUp = irsend->encodeNEC(0x80, 0x12);
|
|
|
|
const uint32_t RDBrightnessDown = irsend->encodeNEC(0x80, 0x1E);
|
|
|
|
const uint32_t RDButtonA = irsend->encodeNEC(0x80, 0x7);
|
|
|
|
const uint32_t RDButtonB = irsend->encodeNEC(0x80, 0x8);
|
|
|
|
public:
|
|
explicit IRLight(int pin);
|
|
explicit IRLight(IRsend *irsend);
|
|
|
|
void setState(bool state);
|
|
bool getState();
|
|
void on();
|
|
void off();
|
|
|
|
void setBrightness(int brightness);
|
|
int getBrightness();
|
|
|
|
void setColorTemperature(int color);
|
|
int getColorTemperature();
|
|
|
|
void brightnessUp();
|
|
void brightnessDown();
|
|
int getBrightnessScale();
|
|
|
|
void begin();
|
|
|
|
~IRLight();
|
|
}; |