Usage
General Usage
To control the cube, launch the BlueCube app on your mobile device (ensuring that the cube is running the BlueCube sketch). The connect screen will be shown - tap "Connect" and the app will search for cubes to connect to. If only one is found it automatically connects, otherwise it will present a list from which you can chose which to connect to.
You can see the menu with all of the available options by sliding the app to the right, or by tapping the three horizontal lines in the top left corner. The options are:-
Menu Item | Description |
---|---|
All | Sets all LEDs on the cube to the selected colour. If "Automatical Change" is selected the cube updates as you change the colour, otherwise tap "Change Cube Colour" to update the cube. You can also choose one of the preset colour favourites, and mange these favourites. |
Shift | Move the current light display one position to the left, right, up, down, forward, or back. |
Set | Tap any of the circles (iOS) or squares (Android) that represent the LEDs on the cube to set it to the colour that has been chosen at the top of this page. Tap again to turn the LED off. |
Next | Set the "next" LED to the chosen colour. |
Set Plane | Set a plane of the cube to the chosen colour. You pick the axis, then the offset. For example X 0 is all LEDs on the left side of the cube, Y 3 would be all LEDs on the back side of the cube, and Z 0 is all of the LEDs on the bottom of the cube. |
Copy Plane | Copy the current light display of a plane to a different plane on the same axis. |
Move Plane | Move the selected planes light display to a different plane, and then set the original planes colour to the chosen colour. |
Line | Draw a line between two LEDs in the given colour. Tap two LEDs on the grid and then tap "Draw Line". |
Box | Draw a box with different style options. Tap the bottom left LED, and the top right LED, then pick if you want a solid colour, only the walls filled in (leaving the centre off), only the edges filled in (leaving the center of the box and walls empty), or whether the walls or edges should be filled with a second colour. |
Sphere | Draw a sphere with different style options. Tap the LED that represents the middle of the sphere, then chose it's size and whether the outside only is light up, or whether the middle of cube is also illuminated in a second colour (solid). |
Connect | Allows you to connect or disconnect from the cube |
User Defined Patterns | Call any user defined patterns in the sketch from the app, and if needed provide a colour to be used. |
Static Favourites | With static favourites, you can save a series of commands for the cube, and then replay them with the tap of a button on demand. |
History | View the commands that have been sent to the cube, and replay any selected commands if you wish. |
Settings | Allows you to control how many items are saved in the history, and to reset the app back to it's default state. |
About | Gives information about the app, how to wire the cube and bluetooth module together, and the location of all of the LEDs. |
Adding User Defined Patterns
To add a user defined pattern you need to do two things. The first is that you need to add the code for the pattern to the sketch, and then upload it to the cube. The second is to tell the app about the pattern.
These steps are demonstrated in the video at the bottom of this page, and outlined step by step below.
Adding pattern to sketch
I recommend that you create the pattern in a class, and then include that class. If you are unsure about this, I recommend you copy the ZigZag.h and ZigZag.cpp files and modify them as appropriate.
Assuming you have a new class (I'm going to use the "Sweep" example from here), you would add it as follows:-
- Copy the Sweep.h and Sweep.cpp files into the same directory as BlueCube.ino
- Open BlueCube.ino in the Arduino IDE
- Sweep requires a delay, so add
#define SWEEP_DELAY 100
under the#define ZIGZAG_DELAY
line - Include the Sweep.h file, by adding
#include "Sweep.h"
under the#include "ZigZag.h"
line - We also need to instantiate the class, so add
Sweep sweep(cube, SWEEP_DELAY);
under the line that saysZigZag zigzag(cube, ZIGZAG_DELAY);
- Now at the bottom of the code, in the
userFunctionHandler
function, we add a new item to theswitch
statement, using the next available number. The code to add is as follows:-
case 4:
serial->println("Sweep");
break;
This is added directly after the lastbreak;
. - Finally we add it into the
loop
function as well. To do this we extend theswitch
statement, using the number we used in the last step. The code to add is as follows:-
case 4:
sweep.update(theColour);
break; - You can now compile and upload the sketch to the cube
Adding pattern to app
Once you have added the user defined pattern to the sketch, you can add it to the app. To do this:-
- Launch the app on your mobile device, and connect to the cube
- Select "User Defined Patterns" from the side menu
- Tap the green "+"
- Tap "Name" and enter a descriptive name. E.g.
Blue Sweep
- Tap "Number" and enter the number that was used in the sketch I.e.
4
- The sweep pattern requires a colour, so tap the toggle next to "Colour Required"
- Tap the colour, and select a suitable blue colour, then click "Done" at the top right
- Tap "Save User Defined Pattern"
- Tap "Blue Sweep" and a blue sweep pattern should display on the cube