{"id":13780887,"url":"https://github.com/cpldcpu/light_ws2812","last_synced_at":"2025-05-16T00:00:31.743Z","repository":{"id":50785200,"uuid":"9283196","full_name":"cpldcpu/light_ws2812","owner":"cpldcpu","description":"Light weight library to control WS2811/WS2812 based LEDS and LED Strings for 8-Bit AVR microcontrollers.","archived":false,"fork":false,"pushed_at":"2024-09-11T18:20:32.000Z","size":3897,"stargazers_count":969,"open_issues_count":7,"forks_count":209,"subscribers_count":101,"default_branch":"master","last_synced_at":"2025-04-13T12:48:53.992Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cpldcpu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"License.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-04-07T21:03:17.000Z","updated_at":"2025-04-05T02:21:23.000Z","dependencies_parsed_at":"2024-05-06T06:24:11.002Z","dependency_job_id":"bc6e3428-6ffe-4e2c-b2d4-25c3790a758d","html_url":"https://github.com/cpldcpu/light_ws2812","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpldcpu%2Flight_ws2812","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpldcpu%2Flight_ws2812/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpldcpu%2Flight_ws2812/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cpldcpu%2Flight_ws2812/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cpldcpu","download_url":"https://codeload.github.com/cpldcpu/light_ws2812/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254442854,"owners_count":22071877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T18:01:20.803Z","updated_at":"2025-05-16T00:00:31.589Z","avatar_url":"https://github.com/cpldcpu.png","language":"C","funding_links":[],"categories":["Miscellaneous"],"sub_categories":[],"readme":"light_ws2812 V2.6\n============\n\nLight weight library to control WS2812 based LEDS and LED Strings on 8-Bit AVR and ARM microcontrollers. The new version 2 of this library supports a simplified interface and arbitrary CPU clock. V2.1 finally adds Arduino support.\n\n[See the library in action on a LPC810](http://www.youtube.com/watch?v=Uwxt7SuSV7Y)\n\n**New** \n- [companion library for APA102 and SK9822 LEDs](https://github.com/cpldcpu/light_ws2812/tree/master/light_apa102_AVR)\n- Added support for SK6812RGBW LED strings. See examples.\n \n**Supported Devices**\n- WS2811 800kHz mode, WS2812S, WS2812B, WS2812C\n- WS2813: Connect BIN of the first LED to ground. \n- SK6812, SK6812RGBW\n- PD9853\n- APA106, APA104\n- Other WS2812 clones: Untested\n- APA102, APA102C, SK9822: Use dedicated library\n \nDescription\n===========\n\nThis is a small Ansi-C library to control WS2811/WS2812 based RGB Leds and strings. Only the 800kHz\nhigh-speed mode is supported. This library uses a bit-banging approach with cycle optimized assembler\ninnerloops. Some advantages of this approach compared to other solutions are:\n\n- Compatible to all AVR MCUs since it does not rely on special periphery.\n- The code timing is automatically adjusted to the CPU clock at compile time.\n- A CPU clock speed of 8 MHz and up is recommended.\n- Much smaller program code: Size optimized assembler without unrolled loops (\u003c50 bytes in most cases)\n- Supports standard AVR, reduced core AVR (Attiny 4/5/9/10/20/40) and XMEGA (untested) without special case handling.\n- Experimental Cortex-M0 ARM support.\n\nThe timing values used in the library were adjusted to work on all devices. Look [here](http://cpldcpu.wordpress.com/2014/01/14/light_ws2812-library-v2-0-part-i-understanding-the-ws2812/) and [here](http://cpldcpu.wordpress.com/2014/01/19/light_ws2812-library-v2-0/) for details.\n\nUsage C - Interface\n===================\n\n- Add \"light_ws2812.c\", \"light_ws2812.h\" and \"ws2812_config.h\" to your project. \n- Optionally update `ws2812_config.h` according to your I/O pin, and include it before\n  including `light_ws2812.h`. Otherwise, the defaults in `light_ws2812.h` will\n  be used.\n- Make sure F\\_CPU is correctly defined in your makefile or the project. (For AtmelStudio: Project-\u003eProperties-\u003eToolchain-\u003eAVR/GNU C Compiler-\u003eSymbols. Add symbol F_CPU=xxxxx)\n- Call \"ws2812\\_setleds\" with a pointer to the LED array and the number LEDs.\n- Alternatively you can use \"ws2812\\_setleds\\_pin\" to control up to 8 LED strips on the same Port.\n\nExamples are provided in the [Examples](https://github.com/cpldcpu/light_ws2812/tree/master/light_ws2812_AVR/Examples) folder. You can build them with the supplied makefile.\n\n\nUsage Arduino\n=============\n\n- If you have Arduino 1.0.5 or newer, simply import the zipfile from light\\_ws2812\\_arduino with sketch-\u003eimport library.\n- Please refer to [these](http://arduino.cc/en/Guide/Libraries) instruction for older versions.\n- To see how you can use it, have a look at the examples.\n- Make sure the Pin you use to address the LEDs really exists! If not, the sketch won't compile or doesn't run correctly on your Arduino.\n- In case of ATtiny85/45/25, library works with [ATtiny \"Classic\" Core](https://github.com/SpenceKonde/ATTinyCore). Tested with Arduino IDE 1.6.7 and ATtiny Classic 1.0.6 and 8MHz internal oscillator, B.O.D disabled. \n\nUsage C++ - Interface\n=====================\n- Add \"light_ws2812.cpp\", \"WS2812.cpp\" and \"WS2812.h\" from the Arduino folder to your project.\n- Refer to the header WS2812.h to determine how to use the class.\n- Ports and LED-Count are handled dynamically, so you can add as many LED-Strips as you got free outpupt ports! \n\nUsage `platformio`\n==================\n\nFor `arduino` and pure C implementations, the library supports `platformio`.\nBy default, `light_ws2812_Arduino` will be used. If `arduino` is not used,\ni.e. the code is written pure C without `arduino`, define one of `build_flags`\nin `platformio.ini`.\n\n| Flag               | Library            |\n|--------------------|--------------------|\n| `LIGHT_WS2812_AVR` | `light_ws2812_AVR` |\n| `LIGHT_APA102_AVR` | `light_apa102_AVR` |\n\nHere is an example `platformio.ini` for `attiny85` and `nanoatmega328` without\n`arduino`.\n\n```ini\n[common]\nplatform = atmelavr\nbuild_flags = -DLIGHT_APA102_AVR\nlib_deps = https://github.com/cpldcpu/light_ws2812.git\nupload_port = /dev/cuaU0\n\n[env:attiny85]\nboard = attiny85\nplatform = ${common.platform}\nlib_deps = ${common.lib_deps}\nbuild_flags = ${common.build_flags}\n\n# with ArduinoISP programmer\nupload_port = ${common.upload_port}\nupload_speed = 19200\nupload_protocol = stk500v1\nupload_flags =\n    -P$UPLOAD_PORT\n\n[env:nanoatmega328]\nboard = nanoatmega328\nplatform = ${common.platform}\nlib_deps = ${common.lib_deps}\nbuild_flags = ${common.build_flags}\nupload_port = ${common.upload_port}\n```\n\nAll examples under [examples](examples) directory are built by `platformio`.\n\nTroubleshooting \n================\nPlease note that incorrect timing is rarely the source of problems. If you want to save some time, go through the items below before altering the library.\n\n#### None or only a part of the string is lighting up ####\n\n * Did you pass the correct array size in the function call?\n * Is the pin configuration correct?\n * Is anything else connected to the output pin you are using? Some development boards have LEDs connected to various pins.\n * Did you choose the correct CPU frequency setting? Did you initialize the clock correctly?\n\n#### The LEDs are flickering and are not showing the intended color ####\n\n * This is often a problem with insufficient current sourcing capability.\n * Are you using a bypass capacitor for each LEDs as indicated in the datasheet? Not using a bypass capacitor will lead to erroneous behaviour. \n * You may have to add an additional electrolytic capacitor at the input of your LED strip if you use long power supply lines.\n * Is your power supply able to supply the required current-level? If set to white at maximum brightness, each LED will draw 60mA. A single USB-Port is barely able to supply 10 LEDs.\n * The LEDs only display white: This can happen if the actual clock frequency of your MCU is lower than that given in F_CPU to the code.\n\nRelease History\n================\n\n- v2.0b 2014/01/19\n\t- Initial release of V2 lib with new interface and architecture.\n- v2.1 2014/03/08\n\t- Added Arduino and C++ support courtesy of Matthias Riegler (@xvzf) \t\t\n- v2.2 2014/11/30\n\t- Improved Ardunio version with variable color order, courtesy of Windell Oskay (@oskay)\n\t- Fixed a bug where the other bits of the port were trashed in Arduino version.\n- v2.3 2015/11/29\n\t- Added support for SK6812RGBW LEDs. Please see example folder for usage.\n- v2.4 2016/11/27\n\t- Increased waittime to support WS2813 LEDs\n- v2.4x 2021 \n\t- Many smaller updates and fixed, please check commit history\n- v2.5 2023/11/18\n    - Changed AVR library to use direct memory access instead of \"OUT\". This should fix issues on newer AVR devices. As a side effect, \n\t4 MHz operation and reduced core Attinyies are no longer supported. Please revert to [V2.4](https://github.com/cpldcpu/light_ws2812/tree/cd149996012fe96bc3d7883cb18a0103fd8e8b3a) in case you require this.\n\t- Updated Arduino library archive\n\t- Fixed an issue where the config include was not used\n \t- Support for LGT8F \t\n- v2.6 2024/05/01\n    - Re-added support for reduced core AVR that was broken in v2.5. Thanks to @U-1F992 for testing\n    - Fixed location of ws2812_config.h \n\n\nYou can find the old V1 here: https://github.com/cpldcpu/light_ws2812/tree/v1.0\n\nTested Combinations AVR\n================\n\n| Device             | 4 MHz  | 8 MHz  | 9.6 MHz | 12 MHz | 16 MHz | 20 Mhz |\n| -------------       |:-------:| :-----: | :------: | :----:| :---:| :---:|\n| ATtiny 85 (Standard Core )| X*      |  X     |         |       |  X   |    |\n| ATtiny 13 (Standard Core)|        |        |    X    |       |     |    |\n| ATmega 8 (Standard Core)|        |        |         |   X    |  X  |    |\n| ATtiny 10 (Reduced Core)| X      |  X      |         |       |     |    |\n| ATmega 168 (Standard Core)|        |        |         |       |  X  |  X  |\n| ATmega 32u4 (Standard Core)|        |        |         |   X    |  X   |  X  |\n\n*only supported by V2.4 and earlier\n\nTested Combinations Arduino\n================\n\n| Device             | 4 MHz  | 8 MHz  | 9.6 MHz | 12 MHz | 16 MHz | 20 Mhz |\n| -------------       |:-------:| :-----: | :------: | :----:| :---:| :---:|\n| Arduino Uno |       |   X   |         |       |  X   |    |\n| Arduino Mega 2560 |        |        |        |       |    X    |    |\n| Arduino Nano |        |        |        |       |    X    |    |\n\nTested Combinations ARM\n================\n|         Device         | 12 MHz | 16 MHz | 20 MHz | 30 MHz | 32 MHz |\n|:----------------------:|:------:|:------:|:------:|:------:|--------|\n|   LPC810 (Cortex M0+)  |    X   |        |    X   |    X   |        |\n| STL32L052 (Cortex M0+) |        |    X   |        |        |        |\n|   KW36Z (Cortex M0+)   |        |        |        |        | X      |   \n\nPlease find updates on https://github.com/cpldcpu/light_ws281\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpldcpu%2Flight_ws2812","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcpldcpu%2Flight_ws2812","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcpldcpu%2Flight_ws2812/lists"}