📜 ⬆️ ⬇️

Rainbow Cube - cube with RGB diodes

Rainbow Cube is a cube with RGB diodes (4x4x4), which can be programmed via Mac / PC, based on the Atmega 328. The Arduino IDE is used for programming.

I will say right away that I collected the cube exploded, but the article will describe the cube that the Chinese already offer in the finished version (after all, not everyone loves / knows how to solder).

Order and delivery

In order to save time on assembling the cube itself, order the Rainbow Cube Kit (Assembled) from seeedstudio.com , through the Hongkong Post.
Moreover, seeedstudio provides a free shipment for goods valued at more than $ 50, but it wasn’t fun - tracking for Ukraine from Hongkong Post turned out to be just before departure outside of Hong Kong. So after departure you need to track the parcel through Ukrpochta.
The delivery process went something like this: on January 25, he made an order, on February 15, the package was already in Kiev, on February 3, the package left Hong Kong, on February 20, he took the package in Donetsk, by mail.

What's inside?

Mailbox has the following dimensions: 19x28x17 cm ^ 3.
Branded box from Seeedstudio, in which there is a cube: 18x12,5x12,5 cm ^ 3.

Included is:

What you need to work?

First we need to download the Arduino IDE and the library for working with Rainbowduino . Files from the archive with the library must be unpacked into the libraries folder, which is located in the folder with the Arduino IDE. After that, you need to connect the cube via USB and install a driver for it.
')

Cube programming

Rainbowduino standard cube features:
I note that to "turn off" one diode you need to transfer as color 0x00 (NULL).

Consider a simple code example with comments for each line:
 /* Rainbowduino v3.0 Library examples: Cube2 Sets pixels on 3D plane (4x4x4 cube) */ #include <Rainbowduino.h> //      Rainbowduino void setup() //       Rainbow Cube { Rb.init(); //   Rainbowduino } /*     . * Z - ,       OZ * X - ,       OX * Y - ,       OY */ unsigned int z,x,y; void loop() //        setup() { for(x=0; x<4; x++) //       OX { for(y=0; y<4; y++) //       OY { //     (0, X, Y)    Rb.setPixelZXY(0, x, y, 0x00FF00); //  24- RGB- } } for(x=0; x<4; x++) //  ,     OX { for(y=0; y<4; y++) //  ,     OX { //     (3, X, Y)    Rb.setPixelZXY(3, x, y, 0x0000FF); //  24- RGB- } } } 
After flashing, the cube glows in the following way:


Having a little experimenting, I made a more complicated script for a cube, the result is lower.
And, of course, for those who liked it, I will leave the source code.

PS: The camera didn’t really want to convey all the beauty of the color change.

That's all! Imagine, experiment, write, friends! And everything will work out for you, because everything ingenious is simple.

Source: https://habr.com/ru/post/170469/


All Articles