npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lannooleaf_spi_controller

v0.2.0

Published

Module to send command over spi to Lannooleaf.

Downloads

16

Readme

Lannooleaf Spi_controller

Package to comunicate with lannooleaf controller. Send command to change leds all at once or individual ones. Get topology information etc...

Contents

Instalation

npm install lannooleaf_spi_controller

Usage

Wake up the controller

import { Lannooleaf } from 'lannooleaf_spi_controller';

const controller = new Lannooleaf();

controller.wake();

Note: Wake should only be called when lannooleaf is in idle state and is not configured, when calling wake when contoller is already initialized unexpected behaviour may apear.

Send other command to controller

import { Lanooleaf, Color, Graph } from 'lannooleaf_spi_controller';

const controller = new Lannooleaf();
await controller.Init();

const graph = new Graph();
await controller.GetAdjList(graph);

var allAddresses = Array.from(graph.map.keys());

// Set the first led of each connected leaf
for (const address of allAddresses) {
  await controller.SetLed(address, 0, new Color(255, 0, 0));
}

// Generate colorsting of 16 with random colors and send to specific unit
var colorString = Array(16).fill(new Color(Math.floor(Math.random() * 255), Math.floor(Math.random() * 255), Math.floor(Math.random() * 255)));
await controller.SetLedString(allAddresses[0], colorString);

await controller.Destroy();

API

Lannooleaf class

controller.Init()

Initialize the controller after creating a object of Lannooleaf.

controller.Destroy()

Cleans up Lannooleaf

controller.Wake()

Sends a wake signal to lannooleaf to start device/topology discovery.

NOTE: This should only be called once when lannooleaf has not been woken yes, unexprected behaviour may apear when calling Wake() when lannooleaf is already woken.

controller.HelloMessage()

Send a hello message to lannooleaf

Returns: A string promise that sould read 'HelloSpi!'

controller.GetGraph(graph)

Get the graph from lannooleaf

  • Parameter graph: Graph object where to add nodes and edges