Giter Site home page Giter Site logo

wsd1 / node-rpi-rgb-led-matrix Goto Github PK

View Code? Open in Web Editor NEW

This project forked from easybotics/node-rpi-rgb-led-matrix

0.0 0.0 0.0 6.53 MB

20240219。这是研究树莓派驱动LED点阵repo “hzeller/rpi-rgb-led-matrix”之后,测试nodejs驱动的尝试。测试结论是:该binding设计的比较简单,包装了很多底层api,在nodejs的背景下使用体验不是很好。所以放弃该方案。 原Description:Pilot your rgb led matrix with Nodejs ! Nodejs binding of rpi-rgb-led-matrix library https://github.com/hzeller/rpi-rgb-led-matrix - Actively Maintained!

License: Do What The F*ck You Want To Public License

JavaScript 8.35% C++ 87.46% Python 4.19%

node-rpi-rgb-led-matrix's Introduction

测试总结

20240215:在rpi3b上测试,添加了example目录。setpixel函数可以亮点。但drawText没有作用。

该binding设计的比较简单,包装了很多底层api,在nodejs的背景下使用体验不是很好。我看了原作者的repo,其还在此基础上提供了一个node-red的上层包装。

https://github.com/easybotics/node-red-contrib-easybotics-led-matrix

个人体验是,建议尝试一下 rpi-led-matrix 这个ts binding。其设计的更加完整系统。

此repo就此不再继续。


easybotics-rpi-rgb-led-matrix

WORKS ON THE RASPBERRY PI 3B AND RASPBERRY PI 4!!!!

tested on node 8 and node 10, probably works on node13 now

check out this guys fork: easybotics#9

targetted at raspbian jesse

Pilot your rgb led matrix with Nodejs on Raspberry Pi ! Nodejs binding of rpi-rgb-led-matrix library https://github.com/hzeller/rpi-rgb-led-matrix

Fork of: https://github.com/zeitungen/node-rpi-rgb-led-matrix

Actively being maintained and modified for: https://github.com/easybotics/node-red-contrib-led-matrix

It is binding recent version of rpi-rgb-led-matrix library.

Installation with npm

$ npm i easybotics-rpi-rgb-led-matrix

Installation with git

$ git clone --recursive https://github.com/easybotics/node-rpi-rgb-led-matrix.git
$ cd easybotics-rpi-rgb-led-matrix
$ npm i

Get some Fun

var LedMatrix = require("easybotics-rpi-rgb-led-matrix");

//init a 16 rows  by 16 cols led matrix 
//default hardware mapping is 'regular', could be 'adafruit-hat-pwm' ect 
var matrix = new LedMatrix(16, 16 );
matrix.fill(255, 50, 100);
matrix.setPixel(0, 0, 0, 50, 255);
matrix.update();

The API has changed somewhat since the zeitungen version

LedMatrix API

All operations modify a local frame buffer, only after calling 'Update' are they printed to the display

  • Constructor: LedMatrix (rows, cols, parallelDisplays, chainedDisplays, brightness, hardware-mapping, rgbSequence, cliFlags)
	rows: height of led panels in pixels
	cols: width of led panels in pixels
	parallelDisplays: number of parallel panels
	chainedDisplays: number of chained panels
	brightness: initial brightness 0 - 100
	hardware-mapping: 'regular', 'adafruit-hat' etc
	rgbSequence: default 'RGB'
	cliFlags: array of cli flags
  • brightness (value)
	set brightness between 0 - 100
  • clear ()
	clear the display buffer
  • drawCircle (x, y, radius, r, g, b)
	draw colored circle to the buffer
  • drawLine (x0, y0, x1, y1, r, g, b)
	draw colored line to the buffer
  • drawText (x, y, text, font, r, g, b)
	draw colored text to the buffer
	to use the fonts that come with the repo it looks something like this

	const input = "hello world!"; //whever you get the input from
	const font  =  __dirname + '/fonts/' + "5x8.bdf";
	led.drawText(x, y, input, font, r, g, b);
	led.update();
  • fill (r, g, b)
	fill the buffer with a color
  • getHeight ()
	get height of addressable space
  • getWidth ()
	get width of addressable space
scroll
setImageBuffer
mysterious methods back from before we picked up this library 
  • setPixel (x, y, r, g, b)
	set pixel to a color
  • update ()
	Draw the current buffer to the display (with vsync!)

node-rpi-rgb-led-matrix's People

Contributors

keptan avatar ryanmich251 avatar zeitungen avatar sebleedelisle avatar clowrey avatar felixmc avatar hzeller avatar lehni avatar wsd1 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.