Giter VIP home page Giter VIP logo

dwm_pico_ws2812's Introduction

dancesWithMachines pico ws2812 library

Animation

This is the basic library for interacting with ws2812 led strips, written in C. What it really is, is a modified ws2812 example provided by Raspberry Pi team, converted to library. I needed this for my project and I decided I might as well share it, to save somebody the trouble.

WARNING! Library is blocking type, needs about 20ms in between changes.

How to build example

Open CMakeLists.txt and edit PICO_SDK_PATH, set your SDK path accordingly.

Add directory called generated inside library directory (./dwm_pico_ws2812/).

Add directory called build inside main repo directory (./).

Next go to build directory and run command cmake ..

If no errors were reported, you can run make command to build the project.

Default pin for led is pin 16 and number of led in led strip is 8. You can edit NUM_PIXELS 8 and WS2812_LEDSTRIP_PIN 16 to match your setup.

How to add to project

Add directory called generated inside library directory (./dwm_pico_ws2812/).

Copy dwm_pico_ws2812 library directory (the one inside the repo) to your project, add necessary lines to CMakeLists.txt and voila.

Necessary lines to add are marked with <-- in CMakeLists.txt, use them as example.

How to use

Every function operates around struct ledStrip_t.

Use ws2812SetupLedStrip() method to setup led strip and then ws2812InitLedStrip() to initiate it.

Use ws2812PutPixel() method to light pixel. Every time method is called, next pixel in the row is lit. Thats exactly why this function is blocking. To change led pattern approx 20ms must pass in between calls, for pattern to change. Check ws2812BlockTest() function in example if you have trouble understanding.

File example.c shows how to use the library.

Every function has description added, refer to them for more info. ...also, it is highly encouraged to get familiar with RP2040 pio. This will help you understand what you are actually initiating / setup-ing.

Licensing

This code is highly based on code provided by Raspberry Pi foundation, as specified in LICENSE.LIB.txt.

This library license is specified in LICENSE.txt file.

Notes

I don't plan to actively maintain and develop this code, but if I somehow extend it's functionality in my main project, I will make sure to also post the changes here.

dwm_pico_ws2812's People

Contributors

danceswithmachines avatar

Watchers

 avatar

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.