Things/things/HardwareH801wifi.h

45 lines
1.0 KiB
C

/*
* H801 WiFi
* off-the-shelf RGBWW led wifi controller
*
* Settings in IDE:
* - Board: "Generic ESP8266 Module"
* - Flash Size: "1M (64k SPIFFS)"
* - Upload Speed: "1152200"
*/
#include "DeviceLed.h"
#include "DeviceRgb.h"
const char* FWNAME = "things@H801wifi";
const byte PIN_LED1 = 14;
const byte PIN_LED2 = 4;
DeviceLed deviceLedW1(PIN_LED1, "white1");
DeviceLed deviceLedW2(PIN_LED2, "white2");
const byte PIN_RGB_RED = 15;
const byte PIN_RGB_GREEN = 13;
const byte PIN_RGB_BLUE = 12;
DeviceRgb deviceRgb(PIN_RGB_RED, PIN_RGB_GREEN, PIN_RGB_BLUE);
Device* devices[] = {
&deviceLedW1,
&deviceLedW2,
&deviceRgb,
};
void hardwareSetup() {
pinMode(PIN_LED1, OUTPUT);
pinMode(PIN_LED2, OUTPUT);
pinMode(PIN_RGB_RED, OUTPUT);
pinMode(PIN_RGB_GREEN, OUTPUT);
pinMode(PIN_RGB_BLUE, OUTPUT);
analogWrite(PIN_LED1, 100);
analogWrite(PIN_LED2, 0);
analogWrite(PIN_RGB_RED, 0);
analogWrite(PIN_RGB_GREEN, 0);
analogWrite(PIN_RGB_BLUE, 0);
deviceLedW1.ledBrightnessHandler("{\"brightness\":100}");
}