Extensions to Espruino for WS2812 modules

Posted on
  • In the internet are some modules with WS2812 Leds. I created extensions to Espruino, written in C to support these modules.
    LED-Matrix 8*8
    Sources are available on github

  • @JumJum the githup link show 404 , can you please update

  • Done, thanks

  • @JumJum any reason for not writing a java script module to handle this ?

  • Yes, and at least first one is a very good reason ;-)

    • loved to do it and learned a lot
    • it's much faster than java script, try to rotate in java script and you will see
    • doesn't take away as many variables compared to java script

    There are already a lot of special functions inside Espruino, that could be a module. May be on a long term we will have a couple of Espruino extensions which can be used to create customized firmware by sticking together firmware modules.

  • ok - I understand - first point is the best ;-)

    I prefer to have JS solutions ;-)

    A idea to use 3 time shift came from a snippet tve gave me, this can be used to rotate / walk like this small sample shows:

    // large ring with 24 NPs
    var NPs = 24;
    var array = new Array(NPs*3).fill(0);
    array[0] = array[1] = array[2] = 32;
    function rotate() {
  • This works from left to right, but how to rotate from top down ;-)

  • right to left works too for a ring ;-)

    function rotateRight() {

    you mean using a matrix NxM and rotate the hole lines horizontal or vertical like scrolling in a loop ?

    Here are two new things for you Rotating Neopixel with trailer effect

    and Adafruit Neopixel ringlight for close-up photography

    - what do you think ?

  • I worked with a lot of optimizations for handling arrays, including Uint8. None of them was even close to compiled C.
    Yes, rotating means rotate full line or full row of a matrix. Another available option is to have a large buffer, like 16by16 and display 8by8 blocks based on input with joystick or something like that.
    BTW, there are already some functions in Espruino, that could have been done easily in JavaScript like E.sum, E.interpolate, E.variance .... If there wasn't the factor called time...

    Hmm, video looks funny. And does'nt look too complex to be done.
    But right now,my focus is to understand events deep inside Espruino.
    First step will be to create something like a Schmitt Trigger having a change event.
    May be once this is done,.... ;-)

    Tschüss für heute

  • hello, I notice you have use ws2812 led strip, as I can use , I know ws2812 is a individually addressable smd led, it have a lot of application, just like use in DIY led product, but about how to use its control agreement, here I also have so many problem in that, so I want to ask, how to control it iC, do you have any idea?

  • I'd take a look at this page: http://www.espruino.com/WS2811

    It should tell you pretty much everything you need to know :)

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Extensions to Espruino for WS2812 modules

Posted by Avatar for JumJum @JumJum