Giter VIP home page Giter VIP logo

shiftbrite's Introduction

This is an Arduino Library for use with the ShiftBrite, an rgb led shift register.

To begin use, place this folder in the libraries folder under your arduino program files.

For Mac OS X - Navigate to Documents > Arduino > libraries

For Windows - Navitage to C://Program Files/Arduino/libraries

Pinout is defined in ShiftBrite.cpp as

#define clockpin 13 
#define enablepin 10
#define latchpin 9
#define datapin 11

This can be adjusted as you see fit.

Current implementation supports up to 4 shiftbrites wired in series.

Future work will involve improving speed, flexibility, and weight of package. Most likely, pinout will be available to be set from constructor, restriction on maximum number of shiftbrites will be removed or increased, package will possibly contain a second lightweight implementation that comes without predefined colors, random colors, etc. Open to suggestions

#Example use:

// define your Shiftbrite variable
ShiftBrite shiftbrite(2);		// this means there are 2 shiftbrites
shiftbrite.setColor(0, "red");		// set the first shiftbrite to the predefined red color
shiftbrite.setColor(1, "blue");		// set the second shiftbrite to the predefined blue color
Color my_color;				// declare your own color
my_color.r = red_pixel_val;
my_color.g = green_pixel_val;
my_color.b = blue_pixel_val;
shiftbrite.setColor(0, my_color);	// set the first shiftbrite to your own color
shiftbrite.turnOff(1);			// turn off the second shiftbrite

If you want to have your own colors predefined, first open ShiftBrite.h

Navigate down to the private variables and look for the where a number of "Color" variables are defined. Define your own Color variables with appropriate names. For example, if you wanted to add a color called lime_green, you would add the line

Color lime_green;

Next find the line that says #define numColors and increment the value there to reflect the number of colors you have added.

Now open up ShiftBrite.cpp and find the function void ShiftBrite::defineColors(). Add your own color in the space provided If we were adding the lime_green color defined above we would add the lines

lime_green.r = 50;		// set the red pixel value
lime_green.g = 205;		// set the green pixel value
lime_green.b = 50;		// set the blue pixel value
lime_green.name = "lime_green";	// set the name of the color
colors[i] = lime_green;		// i should be the number (0 indexed) of the color being defined. 
				//  there are 6 colors already defined, so your first color should
				//  be placed at colors[6]

That's it! Now if you want a shiftBrite to set your new color, simply call the setColor function as we did in the example usage, also shown below.

shiftbrite.setColor(0, "lime_green");

shiftbrite's People

Watchers

James Cloos avatar Chris Smith avatar

Forkers

per1234

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.