2016-05-18 08:53:58 +02:00
|
|
|
/*
|
|
|
|
* 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"
|
|
|
|
|
2016-05-18 09:08:35 +02:00
|
|
|
const char* FWNAME = "things@H801wifi";
|
2016-05-18 09:04:10 +02:00
|
|
|
|
2016-05-19 10:44:20 +02:00
|
|
|
const byte PIN_LED1 = 14;
|
|
|
|
const byte PIN_LED2 = 4;
|
|
|
|
DeviceLed deviceLedW1(PIN_LED1, "white1");
|
|
|
|
DeviceLed deviceLedW2(PIN_LED2, "white2");
|
2016-05-18 08:53:58 +02:00
|
|
|
|
|
|
|
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[] = {
|
2016-05-19 10:44:20 +02:00
|
|
|
&deviceLedW1,
|
|
|
|
&deviceLedW2,
|
2016-05-18 08:53:58 +02:00
|
|
|
&deviceRgb,
|
|
|
|
};
|
2016-05-21 19:19:24 +02:00
|
|
|
|
|
|
|
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}");
|
|
|
|
}
|
2016-12-23 00:03:36 +01:00
|
|
|
|
|
|
|
void hardwareLoop() {};
|