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

shift-seven

v1.0.0

Published

Seven segment display controlled by a shift register

Downloads

4

Readme

Shift Seven

Johnny-Five module for controlling a seven segment display with a shift register.

Support this project by donating on Gratipay.

Getting Started

Shift Seven components must have the shift register pins connected to the seven segment pins in a specific order. Naming the shift register bits A - H, the pins should map to their same-named pins on the seven segment display, with H mapping to DP on the display.

Note: The DP pin is not used for drawing any numbers. However, you may use this when drawing with a custom binary string via ShiftSeven#write().

Seven segment display labeled

Image source: Wikipedia, licensed CC BY-SA 3.0

Breadboard for Shift Seven

Frizting digram: shift-seven.fzz


API

new ShiftSeven(options)

Creates a new ShiftSeven instance.

  • options (Object): The options for initializing the display.
    • pins (Object): The pins for the shift register.
      • data (Number): The data pin.
      • clock (Number): The clock pin.
      • latch (Number): The latch pin.
    • board (Object; optional): Which board the shift register is connected to.
var display = new ShiftSeven({
	pins: {
		data: 2,
		clock: 3,
		latch: 4
	}
});

ShiftSeven#draw(number)

Draws a number on the seven segment display.

  • number (Number): The number to draw, from 0 to 9.
display.draw(5);

ShiftSeven#write(value)

Draws the specified segments on the display.

  • value (String|Number): A bitmask or eight character binary string representing the segments to draw.
    • The string form must contain only 0s (for off) and 1s (for on). The string is ordered the same as the shift register, from pins A - H (A - G, DP on the display).
display.write("11101110");
// or
display.write(238);

ShiftSeven#off()

Turns off the display.

display.off();

new ShiftSeven.Multi(options)

Creates a new ShiftSeven.Multi instance to create a multi-digit display from multiple shift register/seven segment display pairs.

  • options (Object): The options for initializing the display.
    • leadingZeros (Boolean; optional; default: false): Whether leading zeros should be written when the currently drawn number doesn't require all segments.
    • displays (Array): Array of ShiftSeven options for each individual shift register/seven segment display pair.
var display = new ShiftSeven.Multi({
	leadingZeros: true,
	displays: [
		{
			pins: {
				data: 2,
				clock: 3,
				latch: 4
			}
		},
		{
			pins: {
				data: 8,
				clock: 9,
				latch: 10
			}
		}
	]
});

ShiftSeven.Multi#draw(number)

Draws a number on the seven segment displays.

  • number (Number): The number to draw, from 0 to 10^(display count) - 1.
display.draw(25);

ShiftSeven.Multi#off()

Turns off the display.

display.off();

License

Copyright Scott González. Released under the terms of the MIT license.


Support this project by donating on Gratipay.