GithubHelp home page GithubHelp logo

pavlecc / ofxpixelpusher Goto Github PK

View Code? Open in Web Editor NEW

This project forked from morphogencc/ofxpixelpusher

0.0 1.0 0.0 52.4 MB

A C++ library to control PixelPusher LED Controllers, designed with openFrameworks in mind.

License: MIT License

Makefile 0.12% C++ 99.88%

ofxpixelpusher's Introduction

ofxPixelPusher

A C++ implementation of pixelpusher software.

Requirements

This add-on requires ofxAsio for networking. See the repository for how to setup ofxAsio.

This implementation of the pixelpusher protocol attempts to be as framework-agnostic as possible; thus, it tries to avoid using openFrameworks-specific classes such as ofLog and ofThread, instead using the c++ equivalents. ofxAsio follows a similar paradigm, so the entire project should be portable to any other C++ framework.

Usage

In your application, create a std::shared_ptr<DiscoveryService> instance using DiscoveryService::getInstance(). This creates a separate thread that looks for PixelPusher announcements, and registers the PixelPushers with the Service.

Once a PixelPusher is detected, you can grab one with any of the three following methods:

  • DiscoveryService::getPushers()
  • DiscoveryService::getGroup(long groupId)
  • DiscoveryServiceit::getController(long groupId, long controllerId)

The first two methods return a vector of shared pointers (std::vector<shared_ptr<PixelPusher> >), while the last one returns either an empty pointer or a pointer to a PixelPusher.

Once a PixelPusher is selected, strips can be assigned values with

  • setStripValues(int stripNumber, unsigned char red, unsigned char green, unsigned char blue)
  • setStripValues(int stripNumber, std::vector<shared_ptr<Pixel> > pixels)

The first method sets all pixels in the strip stripNumber to the same color, while the latter method copies the vector of Pixel objects directly to the Strip objects. See the header file Strip.h for a more exhaustive listing of ways to set pixels.

Alternatively, you can call getStrips() on a PixelPusher object to get a deque of strips that you can iterate through, or getStrip(int stripNumber) to get a pointer to a particular strip. Once you have a pointer to a Strip, you can set the pixels with a variety of methods -- look at the header file to see a complete listing.

Each PixelPusher object automatically creates its own CardThread that manages sending data to the PixelPusher on its own thread. As long as you update the strips to reflect current data, everything else should run itself!

Options

There are a variety of options that can be used to adjust the LEDs. Currently implemented are:

  • PowerScale -- this controls the overall brightness of the LEDs; use a value between 0 and 1.
  • ColorCorrection -- this corrects the color ratios so that the tuple (255, 255, 255) produces a "true" white pixel. Look at Pixel.h for a full listing of options.
  • ColorTemperature -- this further corrects the colors to reflect a specific light source. Look at Pixel.h for a full listing.
  • Tint -- you can also "tint" a strip by using the corresponding function call. This effectively multiples the assigned color (set via setPixels()) by a constant tint -- this allows you to either manually correct the color to a setting non available with the presets, or allow for some neat tricks in animating the strips.

Examples

  • example-colorFade -- sets all known pixels to the same color, slowly cycling through hues.
  • example-colorChase -- sets all strips to a classic rainbow chase sequence.
  • example-tileMapping -- shows how to use map strips using textures, using a TwentySquared tile as an example.

Contributions

This project uses the Git Flow paradigm. Before contributing, please make your own feature branch with your changes.

This project was originally developed at Small Design Firm, before being open sourced on Github.

More Information / Credits

For more info about PixelPusher visit:

To purchase a PixelPusher (and BetterPixel products), go to:

Color Correction and Color Temperature presets were lifted straight from the FastLED library.

ofxpixelpusher's People

Contributors

scottnla avatar pavlecc avatar

Watchers

 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.