d1_mini_pro-sensor-mqtt/include/IRLight.h

52 lines
1.1 KiB
C
Raw Normal View History

#pragma once
2022-12-30 18:31:20 +03:00
#include <ESP8266WiFi.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
#include <HALightColorTemperatureBrightness.hpp>
class IRLight: public HALightColorTemperatureBrightnessController {
private:
bool state;
2022-12-30 18:31:20 +03:00
short brightness;
byte color_temp;
2022-12-30 18:31:20 +03:00
IRsend *irsend;
2023-02-14 20:07:13 +03:00
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);
2022-12-30 18:31:20 +03:00
void setState(bool state);
bool getState();
void on();
void off();
2022-12-30 18:31:20 +03:00
void setBrightness(int brightness);
int getBrightness();
void setColorTemperature(int color);
int getColorTemperature();
2022-12-30 18:31:20 +03:00
void brightnessUp();
void brightnessDown();
int getBrightnessScale();
void begin();
~IRLight();
};