Coder Social home page Coder Social logo

ofxopc's Introduction

ofxOPC

A openFrameworks addon for Open Pixel Control and FadeCandy Server

ofxOPC is an addon for openFrameworks (v0.8.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.

It is a work in progress and there are still some issues that need to be addressed. However, it works as it stands.

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
  • So far every (known) Neopixel unit in its own class with its own implementation.
  • 12px Ring
  • 16px Ring
  • 24px Ring
  • 60px Ring
  • Neopixel Strip
  • Neopixel Stick
  • Neopixel Grid 8x8
  • Neopixel Shield 5x8

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; NeoPixelRing24px ring;
  • Then in the .cpp file setup the LED unit and the OPC client.
opcClient.setup("127.0.0.1", 7890); ring.setupLedRing();
  • Then grab the image data you want by positioning the grabber over the area. The isConnected method protects the application from crashing if connection is lost to the server.
ring24px.grabImageData(ofPoint(ofGetWidth()/2,ofGetHeight()/2));
ring24px.update();

if (!opcClient.isConnected())
{
    opcClient.tryConnecting();
}
else
{
    opcClient.writeChannelOne(ring24px.colorData());
}
  • Draw the resulting data to our visualisor
ofBackground(0);
ring24px.drawGrabRegion(hide);

ring24px.drawRing(50, 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

  • 12px Ring
  • 16px Ring
  • 24px Ring
  • 60px Ring
  • Neopixel Strip
  • Neopixel Stick
  • Neopixel Grid 8x8
  • Neopixel Shield 5x8
  • Neopixel Multiple Strips
  • Neopixel Chained Rings
  • Multiple Neopixel units and Syphon

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());

To Do

  • Allow users to specify the size of the elements in setup proceedure
  • Create return methods with data about the elements.
  • Need to Create a Single Neopixel unit

ofxopc's People

Contributors

dhaylock 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.