Giter VIP home page Giter VIP logo

ofxopc's Introduction

ofxOPC

A openFrameworks addon for Open Pixel Control and FadeCandy Server

ofxOPC is an addon for openFrameworks (v0.9.0+) that allows users to communicate to Neopixel LED units through Fadecandy and open pixel control. Draw graphics to the oF window, place the Neopixel grabber on the screen and the addon collects, encodes and sends the pixel data to the Fadecandy.

alt text

If you would like to contribute to the addon feel free to fork, hack and mod the code. Also drop me a line and let me know how you end up using the addon.

@david_haylock

Requirements

What the addon includes

  • The ofxOPC client class
  • ofxNeoPixelRing
  • ofxNeoPixelStrip
  • ofxNeoPixelGrid
  • ofxNeoPixelJewel
  • ofxCustomNeoPixel

Getting Started

  • After downloading ofxOPC, place it inside your openFrameworks addon folder.

  • Create a new openFrameworks project in Project Generator and select the ofxOPC and ofxNetwork addons.

  • Alternatively you will need to add the addons manually, drag and drop the folders into the addon folder in xCode. Then make sure the paths are linked inside Build Settings.

  • In your testApp.h or ofApp.h file, link the addon's .h file, by adding #include "ofxOPC.h" underneath #include "ofMain.h".

  • Create an ofxOPC client and a Neopixel unit in your .h file.

	ofxOPC opcClient;
	ofxNeoPixelRing ring;
  • Then in the .cpp file setup the LED unit and the OPC client.
	opcClient.setup("127.0.0.1", 7890);
	opcClient.setupStage(500,500);
	ring.setupLedRing(posX,posY,numLeds,spacing);
  • A new feature is the Stage. The stage is where you draw your graphics for the leds. Essentially its an FBO! But it gives you access to the pixel data of the screen. In the update function call:
    opcClient.beginStage();
    
    opcClient.drawDefaultEffects(effect);
    //or your own graphics
    opcClient.endStage();
    
  • Then write your data to the leds
if (!opcClient.isConnected()) 
{
	opcClient.tryConnecting();
}
else
{
	opcClient.writeChannelOne(ring24px.colorData());
}
  • Draw the resulting data to our visualiser
    ofBackground(0);
    opcClient.drawStage(hide);
    ring12px.drawGrabRegion(hide);
    ring12px.drawRing(opcClient.getStageWidth()+100, 50);
  • Your Leds should start to flash or fade depending on what you put underneath the grabber.

  • See the examples for more specific details on each of the Neopixel units.

Examples

Example Image
ofxNeoPixelRings
ofxNeoPixelStrips
ofxNeoPixelGrids
Big Grid
Multiple Strips
Multiple Neopixel units and Syphon
Chained Neopixels
Custom Neopixels
Generic Neopixels
Shader
x-Osc
Multiple Fadecandy's

Important

The Fadecandy drives 8 x 64 LEDS = 512 LEDs, thats one DMX Universe. However, each pin only drives 64 LEDs. If you want to connect 1 or more units with 64 LEDs each, separate the data accross two channels. For clarity and less risk of overwriting your data.

opcClient.writeChannelOne(ring60px.colorData()); opcClient.writeChannelTwo(ring60px.colorData());

Multiple Fadecandys

There is an example that should drive 1024 leds. (I currently dont have two Fadecandys) When running this example, you will need to run the ./fcserver with a unique config file. I've uploaded one inside the example bin/data folder.

For more information please read @scanlime server configuration readme.

##Grids If you would like to use the 32x32grid please alter line 24 of ofOPC.cpp from

uint16_t data_length = 8 * 64 * sizeof(OPCPacket_SPCData_t);

to

uint16_t data_length = 16 * 64 * sizeof(OPCPacket_SPCData_t);

To use the 32x32 grid check this guide.

http://docs.pixelmatix.com/SmartMatrix/

Thanks to @rorypickering for the link.

ofxopc's People

Contributors

corybarr avatar dhaylock avatar rpickering avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ofxopc's Issues

What is the ofxOPC license?

Hello,

I'm considering modifying ofxOPC's code (or just using ideas of pulling screen color as data for hardware) for a future project library. But I before I attempt that I would like to know what is the license of ofxOPC?

Multiple FadeCandy's

Hi,

Have you tried the multiple FadeCandy's with the ofxOPC class?

I've tried this:

uint16_t data_length = NUMBER_OF_FADECANDYS * 8 * 64 * sizeof(OPCPacket_SPCData_t);

And offset as:

uint16_t channel_offset = (fadeCandyIndex-1)_8_64 + (channel - 1) * 64;

But always got

"Unsupported OPC command: nnn"

Do you have any clue or have experience with several FadeCandys?

Imanol

M_PI undeclared

Great project, thank you!

In Visual Studio Community Edition 2015 I get multiple errors stating that M_PI is undeclared in ofxNeoPixelRing.cpp. Everything works if I directly include math.h like this:

#define _USE_MATH_DEFINES
#include <math.h>

I did not submit a pull request because this has not been tested on Linux and OSX yet and it probably makes more sense to change this elsewhere.

All strips not working on oF 0.9.0

Hey there,
Thanks for the great addon I'm testing right now.
The rings works good, and I love the effects you've made for testing. Congrats!

However, I have a led strip in my hand, not a ring :)
So I tried

  • SingleStick
  • Strip60px
  • multipleStrips

and none of them works.
On the rendering in the top left corner, it doesn't get any colors.
See image attached.
screenshot from 2016-02-02 12 07 12

My version of oF is 0.9.0, did someone else tested with this version?

Thanks,
Emmanuel

Implementing ofSetBackgroundAuto(false) in the effect window

Hi, I made this effect in OF that uses ofSetBackgroundAuto(false). How can I implement this in the OPC effect window?

When I use the opc library it seems to not respect ofSetBackgroundAuto(false).

How do I make sure the effect window uses ofSetBackgroundAuto(false)?

I put this in Effects case 2 using an example project:

` ofFill();

                    ofSetColor(200,300/10,200);
                    ofDrawRectangle(ofRandom(200), ofRandom(20),300, 300);
                    ofNoFill();
                    ofSetColor(255, 255,255, 255); // contour (stroke) color
                    ofDrawRectangle(ofRandom(200), ofRandom(20),300, 300);
                    for(int i = 0; i < 200; i ++){
                        ofSetColor(2000-i,20/10+i,200);

                        ofDrawRectangle(ofRandom(2000)+i, ofRandom(2000)-i,300, 300);
                        ofNoFill();
                        ofSetColor(255, 255,255, 255); // contour (stroke) color
                        ofDrawRectangle(ofRandom(200), ofRandom(20),300, 300);
                    }
                    ofFill();`

My goal is to have the rectangles stay on screen but they don't. Do you have any recommendations to get ofSetBackgroundAuto(false) in the effects window to work?

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.