0 Comments
LED Cube 8x. 8x. 8 7. Steps with Pictures. A wireframe box is a good geometric shape to show in a monochrome 8x. LED cube. It gives a very nice 3d effect. We made two box animation functions for the LED cube. Effectboxshrinkgrow draws a wireframe box filling the entire cube, then shrinks it down to one voxel in one of 8 corners. We call this function one time for each of the 8 corners to create a nice effect. Effectboxwoopwoop draws a box that starts as a 8x. It then shrinks down to a 2x. Or in reverse if grow is specified. Here is how effectboxshrinkgrow works. It takes four arguments, number of iterations, rotation, flip and delay. Rotation specifies rotation around the Z axis at 9. Flip 0 flips the cube upside down. To make the function as simple as possible, it just draws a box from 0,0,0 to any point along the diagonal between 0,0,0 and 7,7,7 then uses axis mirror functions from draw. Enter main iteration loop. Enter a for loop going from 0 to 1. Set xyz to 7 i. This makes xyz the reverse of i. Expand your Pi Stackable expansion boards for the Raspberry Pi Serial Pi Plus RS232 serial communication board. Control your Raspberry Pi over RS232 or connect to. See step 17 for more info regarding the music input mode for nonRAMP boards. There are now 7 music modes in the posted code, and I am looking for more. We want to shrink the box first, then grow. We just used one variable since x, y and z are all equal along this diagonal. When i 7, the box has shrunk to a 1x. If i is greater than 7, xyz is set to i 8, which makes xyz travel from 0 to 7 when i travels from 8 to 1. We did this trick to avoid having two for loops, whith one going from 7 0 and one from 0 7. Blank the cube and delay a little bit to make sure the blanking is rendered on the cube. Disable the interrupt routine. We do this because the mirror functions takes a little time. Without disabling interrupts, the wireframe box would flash briefly in the original rotation before being displayed rotated. Draw the wireframe box in its original rotation. Do the rotations. If flip is greather than 0, the cube is turned upside down. Z and 3 is 2. 70 degrees. To get 2. 70 degrees we simply mirror around X and Y. Enable interrupts to display the now rotated cube. Delay for a while then clear the cube. The other function involved in the wireframe box effect is effectboxwoopwoop. The name woopwoop just sounded natural when we first saw the effect rendered on the cube . The woopwoop function only does one iteration and takes two arguments, delay and grow. If grow is greater than 0, the box starts as a 2x. Here is how it works. Clear the cube by filling the buffer with 0x. For loop from 0 to 3. Set ii to i. If grow is specified we set it to 3 i to reverse it. Draw a wireframe box centered along the diagonal between 0,0,0 and 7,7,7. One corner of the box uses the coordinates 4ii on all axes, moving from 4 7. The other corner uses 3 ii on all axes, moving from 3 0. Delay for a while, then clear the cube. These two functions are used as one single effect in the effect launcher. First the shrink grow effect is called 8 times, one for each corner, then woopwoop is called four times, two shrink and grow cycles. To launch the shrink grow function, we used a for loop with some neat bit manipulation tricks inside to avoid writing 8 lines of code. The second argument of the shrink grow functions is the rotation, in 4 steps. We are counting from 0 to 7, so we cant simply feed i into the function. We use the modulo operator to keep the number inside a range of 0 4. The modulo operator divides by the number specifies and returns the remainder. The third argument is the flip. When flip 0, the cube is not flipped. We use the bitwise AND operator to only read bit 3 of i. Bitwise operators are an absolute must to know about when working with micro controllers, but that is outside the scope of this instructable. The guys over at AVR Freaks have posted some great information about this topic. You can read more at http www. PNphp. BB2 fileviewtopic t3. One of the most important factors that can contribute to a project falling into obscurity is does it work as well for callsSMSdata connections as a real phone would |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |