firmware and software for the L3D cube
Switch branches/tags
Nothing to show
Clone or download
Alex Hornstein Alex Hornstein
Alex Hornstein and Alex Hornstein updated demo code
Latest commit efae1c0 Dec 19, 2014

Readme.md

This is a set of demo software for the L3D cube. There are two types of programs in this repository: Native programs, that run on the spark processor in the cube, and don't require a wifi connection to work, and Streaming programs, that stream data to the cube from a computer or phone over wifi.

For streaming programs, you'll need to load the Listener program(located in the /Streaming directory) onto the Spark, and then run the program on your computer that generates the pattern for the cube. Data is streamed via UDP multicast on port 2222, which most home routers support. If you're not seeing any data come through, it's possible that your router is blocking multicast packets. If you can fiddle with the router's settings, check to see if it's blocking packets on port 2222, and if it's disabling multicast.

If you have a network that requires you to click through a form to get access to the web, the processor in the cube

  • Getting started

    You’ll need to do some quick setup so that you can load programs onto the processor in your cube. You’ll need to tell the processor the credentials for your wifi network, so that it can connect to the internet and receive new programs. First, turn your cube on its side, and put your processor into listening mode by pressing and holding the ‘mode’ button for three seconds, until it starts flashing blue. More instructions are available here

Follow the instructions here to use your phone or tablet to set up the processor.

If you prefer to work on the command line, you’ll need to plug the USB cable into your computer and follow the setup instructions here to install the command-line interface for the processor. Once it’s installed, run the command ‘spark setup’, and a prompt will walk you through the process of creating a (free) account with Spark, loading your wifi credentials onto the processor and linking the processor to your account.

Once your processor is set up, you’re ready to load a program onto it. We prefer to work from the Spark web interface — all the code is written in the browser, the compiler is in the cloud, and as long as your cube has a wifi connection, you load a new program onto the cube just by clicking a button. To get started, check out the example included in our L3D library, and try flashing it onto your cube.

Unfortunately, Spark doesn’t have a great setup yet for sharing code online. We’re working with them to set something up, but until then, the best way to ‘fork’ our code and start editing it is to create a new app in the spark editor, and copy-paste the code from the github repository into the app.

To further complicate matters, the spark interface has a couple quirks that make copy-pasting a little tricky. Here’s the best way we’ve found to paste in some new code:

Let’s say that there’s a native program that has three files:

demo.ino — this is the main file in the app. Includes the spark library ‘Neopixel’ colors.cpp — a couple functions for handling colors colors.h — defines some datatypes

  1. Create a new app in the spark editor — you can call it anything you like, but for this example, let’s say you call it ‘myApp’ creating a new app naming the app

  2. The editor will open up with a single file, myApp.ino Copy all the code in your local copy of demo.ino and paste it into the myApp.ino file in your browser. Once it’s pasted, ** be sure to click ‘save’ **. pasting in new code

  3. Next, you’ll need to add the spark neopixel library. Click on the ‘libraries’ icon: library icon

Next, find the ‘neopixel’ library in the list of libraries (it’s quite popular, so it’s usually at the very top), and click on it. neopixel library

Scroll down on the left side of the screen, and click the ‘include in app’ button:

include in app

It will display a list of all your apps. Scroll to the bottom and select ‘myApp’

select your app

Scroll down to the bottom of a list again, and click ‘add to this app’

add to this app

Great! That’s all done

  1. Finally, you need to add the colors.h and colors.cpp files to the sketch. Click the ‘+’ icon on the top-right of the web interface.

add files

It will create a .cpp and .h file, and prompt you to enter a name for the files. Type in ‘colors.h’, and it will automatically rename both files.

renaming files

Paste in the code from both colors.h and colors.cpp

pasting code

Aaaand you’re good to go!

  1. To load the code onto your spark, just click the ‘flash program’ icon on the top left of the interface

flash program

The color LED on your spark should quickly turn purple and begin flashing to show that the program is loading. It usually takes about 20 seconds to load a new program, although we’ve seen it take up to a minute when we’re working outside of the US.