Use your Raspberry Pi to control 7 segment LED displays and LED matrixes (matrices?) that incorporate the MAX7219 chip. These devices are widely and cheaply available online. You can connect these to any of the Raspberry Pi GPIO pins and you can daisy chain 8 of the devices together.
npm install rpi-led-control
var LedControl = ;var lc = datapin clockpin cspin;// if you're using a LED matrix :// On matrix number 0, turn the LED at position 5,4 on.lc;lc;// if you're using a 7 segment display :// on matrix number 0, show the number 1023. Defaults are right justified.lc;// on matrix 0, change the digit at index 3 to the number 5.lc;// it also makes an attempt at showing letters from the alphabet, with varying resultslc;lc;lc;lc;lc;
onoff GPIO library is required, it should be installed automatically on an npm install but if not you can get it on github at https://github.com/fivdi/onoff
Returns a LedControl object that can control up to 8 different LED displays daisy chained together. The first three parameters are the GPIO pin numbers that the data, clock and cs (chip select) pins are connected to. The optional parameter numberOfDevices allows you to select how many displays are daisy chained together (the default is 1 so leave it empty if you're just working with one device).
Once the constructor has been called, the connected displays will be initialised and ready to run.
Subsequent calls to the API usually require a deviceNumber which is the index number for each display in the chain. If you are just using one display, this will always be 0, if you have multiple displays, index 0 is the last one in the chain.
Adjusts the brightness of the display specified by deviceNumber, where brightness can be an integer from 0 (dimmest) to 15 (brightest). If you are just using one display, deviceNumber should always be 0.
Turns all the LEDs on the display off, where deviceNumber is the relevant display.
This is for use on the 8x8 LED matrix displays, turns an individual LED on or off.
For use on 7 segment displays, displays a number on a given digit of the display.
The same as setDigit, except it will attempt to display an alphanumeric character on the display. Obviously it is impossible to represent some letters in seven segments (ie m and v) but it makes a valient attempt nonetheless.
A simple way to show a number on the display. If you just provide a number, it will work out how to represent that on the display, right justified by default, and including the decimal point where relevant.