Cube Code - Numerous Patterns

The "Cube4" is a 4x4x4 RGB LED cube with an Arduino Leonardo compatible onboard controller. [Product page]
Post Reply
neographophobic
Posts: 9
Joined: Mon Sep 28, 2015 6:36 am

Cube Code - Numerous Patterns

Post by neographophobic » Mon Mar 07, 2016 10:00 am

I’ve published to Github (https://github.com/neographophobic/Cube4-Sketches) a series of sketches I have created for various different patterns.

A number of the patterns have non-blocking versions, which are designed to run using state machines and millis() instead of delay(). This is particularly handy if you are trying to interact with the cube while one of these patterns are running. These non-blocking versions have also been created as classes, which make it easier to include them in other sketches.

Some of the patterns require an additional library to be installed that I’ve created with shared functions that I’ve found to be useful when interacting with the cube. The library is Cub4_ARUtils and can be found at https://github.com/neographophobic/Cube4_ARUtils.

The Github page contains all of the steps needed to download and install the library and sketches, a description of each of the patterns, and a link to a Youtube video of it in action. It also lists whether a sketch requires the Cube4_ARUtils library or not.

The patterns included are:-
  • Blank
  • ColourPulse
  • Cube Edge
  • Expanding
  • Face Expanding
  • Face Peel
  • Face Sweep
  • Flashing Cubes
  • Letters (unchanged from my previous post)
  • Looping Boxes
  • Plane Move
  • Random Fill
  • Random Pull
  • Roaming Cubes
  • Rotate Plane
  • Snake
  • Spiral
  • Splat
  • Sweep
  • Wave
  • ZigZag
Additionally I’ve been playing with making some existing community provided or example sketches non-blocking. The sketches that I’ve made non-blocking are available in the 3rd Party folder, and include:-
  • Colour Fader
  • Cubes
  • DoubleCube
  • Emergency Flashing
  • Heartbeat
  • LaserShow
  • RainStorm
  • Random Colours
  • Test Pattern
I hope somebody finds these to be useful. It’s the first time I’ve played with using state machines and millis() instead of delay(), so if anybody has any suggestions on how to improve my approach or any of the sketches it would be appreciated.

smokinjoe52
Posts: 1
Joined: Mon Mar 14, 2016 12:12 am

Re: Cube Code - Numerous Patterns

Post by smokinjoe52 » Mon Mar 14, 2016 12:20 am

This is great stuff. Unfortunately, I completed a similar cube from Seeedtronics a couple months ago, and have not been able to find ANY sketches for it. (other than their examples) It uses the Arduino compatible Rainbowduino. I am assuming your sketches would not work. Any idea if that is true?

Just wondering if you are planning to combine these sketches into one super sketch that could loop as the main cube sketch. My cube has an acrylic case and it is a PITA to take apart and reload. I would like to have something that combines most of your sketches and run it forever.

Any comments about my chances using your code in my cube would be appreciated.

Thanks,

Joe

neographophobic
Posts: 9
Joined: Mon Sep 28, 2015 6:36 am

Re: Cube Code - Numerous Patterns

Post by neographophobic » Sun Mar 20, 2016 11:57 pm

The code I've posted is written specifically for the Freetronics cube. That said I've had a look at the Rainbowduino doco, and while my code won't work directly, with some work I'm sure you could adapt some of the sketches to work. For example where I use cube.set(X, Y, Z, COLOUR), the Rainbowduino version is Rb.setPixelZXY(Z,X,Y, COLOUR), however the Rainbowduino doesn't appear to provide items like line, box for a cube.

As for combining the items into a larger demo reel, I don't plan on doing that, but there is nothing stopping that from happening (pending you can fit it in the available memory). They sketches I've provided should be easy to copy and paste the relevant bits together to make a combined sketch.

Sorry I can't be of more help.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest