Giter Site home page Giter Site logo

klimbot / milight-controller-esp8266 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from koenieee/milight-controller-esp8266

0.0 2.0 0.0 71 KB

Use the ESP8266 to control your home MiLights using the WiFi gateway bridge connected to the MiLights.

License: GNU General Public License v3.0

C++ 100.00%

milight-controller-esp8266's Introduction

Milight

An ESP8266 library to control Milight / LimitlessLED LED strip controllers via the WiFi interface of the ESP8266 using the bridge that is connected to the MiLight bulbs.

#Thanks To

The original MiLight code worked only with the Arduino Ethernet shield, I modified the existing code so it now also works on the ESP8266 WiFi microcontroller.

(Arduino) repo can be found here: https://github.com/IowaScaledEngineering/Milight

A working example for the ESP8266 can be found in the examples directory.

Functions

void Milight::begin(WiFiUDP * udp, IPAddress * addr, uint16_t port)

The begin() function sets up the Milight control object, connects it with an active WiFi UDP connection, and tells it where to find the Milight Wifi gateway.
When the WiFiUDP object is passed in, it should already be connected to the same network the MiLight WiFi Bridge is on.

addr is the address of the target Milight Wifi gateway, and port is the UDP port on which to connect.

void Milight::on(uint8_t channel, uint8_t color, uint8_t intensity)

The on() method sets a given channel to a certain color and intensity.

channel is a number, 0-4. 0 means 'all channels', whereas 1-4 correspond to channels 1-4 on the controller

color is a number 0x00-0xFF. The colors are as defined by Milight / LimitlessLED, except for 0x00, which is overloaded to be "white"

intensity is a percentage, 0-100. 0 is the same as executing the off() method, and will shut off the LEDs on a given channel. 100 is full on.

void Milight::off(uint8_t channel)

The off() method shuts off a given channel.

channel is a number, 0-4. 0 means 'all channels', whereas 1-4 correspond to channels 1-4 on the controller

void Milight::workQueue()

The workQueue() function should be called each time around the loop.
It checks if there are commands queued up to be sent (they can only be sent to the gateway so quickly) and if enough time has passed, it will transmit one.
Otherwise it returns immediately. Your main loop() function should not stall, otherwise packets will not get transmitted in a timely fashion.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.