4tronix Cube Bit Addressable RGB LEDs
- 4tronix CUBE3, Awesome is the best way to describe these magical RGB LED cube kits. The Cube: Bit can be assembled using just a screwdriver & within a few minutes you'll have created some stunning lighting & visual effects that you can use for a whole host of things, such as learning about coordinates in 2D & 3D, indications for sensory events from your SBC, decorative lighting, the possibilities are endless. The Cube: Bits are made out of pre-assembled slices that have neopixel LEDs on both sides, making a 3x 3x 3 matrix when assembled. Once assembly is done you have to use the Cube: Bit Base (available separately) to provide power & to connect a controller or to directly connect to a BBC micro:bit or Raspberry Pi Zero (full size Raspberry Pi work fine of course, but don't fit directly without using an extension GPIO cable, or simply 3 female-female jumper cables for 5V, Gnd & GPIO18). With micro:bit we have written a special Makecode package (see below) that "knows" about the shape of all the cubes & can map from x, y, z coordinates directly to a pixel anywhere in the cube. Write to a whole plane of pixels at once, create a moving rainbow effect in only a few lines. With Raspberry Pi you can use any of the neopixel code already available to drive your Cube: Bit eg. Pimoroni, Adafruit or 4tronix neopixel products. Make Code Package for 4tronix Cube: Bit Magical RGB Cubes of Awesome Helper routines for using the neopixels in the Cube: Bit range of Cubes Defining the Cube The first thing you should do is create a Cube object with the required
Dimensions per side. Use the block:create cube:bit on pin 0 with side <3/4/5/6/7/8> Then set the brightness to be used from 0 to 255. If this block is not used, then the brightness is set to 40. We strongly recommend keeping this at less than 100. All values sent to the LEDs after this command will be scaled down to fit in this maximum brightness level.set cube:bit brightness to <0...255> Using Cube: Bit Pixels Each pixel can be addressed by using the pixel ID which is a number from 0 to the number of pixels in the cube minus one. eg. a 3x 3x 3 cube has 27 pixels so the ID can be 0 to 26, 4x 4x 4 has 64 (ID 0 to 63) & 5x 5x 5 has 125 (ID 0 to 124)set pixel color at ID to The colour value is a number. There are some pre-define colours (eg. Red, Yellow, etc) or you can put in a simple number, or you can define separate Red, Green & Blue values using the map colour blockconvert from red, green, blue If you want to specify the x, y, z position of the pixel then use the mapping block to create the pixel IDmap from x y x Whenever changing the colour of pixels or clearing them, or rotating them, you will need to display the result afterwards. Use the show changes block for thisshow Cube: Bit changes You can also set a whole plane of pixels to the same colour. eg. set the top slice to blue, or the left side to green. Use the set plane block:set plan on axis <xy, xz, yz> to <colour> 4tronix Cube: Bit 3x 3x 3 Addressable RGB LEDs