A demo code for "mbeduino" + "4x4x4 LED Cube shield". More complex (fancy) demo is available at ... \\ http://mbed.org/users/okano/programs/LED_Cube444_mbeduino_demo/\\ A class library of LED_Cube444...\\ http://mbed.org/users/okano/libraries/LED_Cube444/\\ Hardware test code...\\ http://mbed.org/users/okano/programs/mbeduino_LED_Cube444_test/\\ About the hardware : \\ http://mbed.org/users/okini3939/notebook/mbeduino/\\ http://www.galileo-7.com/?pid=20015630\\
LED_Cube444_demo.cpp@1:90dd1edfce17, 2010-12-08 (annotated)
- Committer:
- okano
- Date:
- Wed Dec 08 02:06:06 2010 +0000
- Revision:
- 1:90dd1edfce17
- Parent:
- 0:828a93c038cd
rev0.51: Document modification and small change in main() function
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
okano | 0:828a93c038cd | 1 | /** mbeduino demo code (with 4x4x4 LED Cube shield) |
okano | 0:828a93c038cd | 2 | * |
okano | 1:90dd1edfce17 | 3 | * @class LED_Cube444 |
okano | 1:90dd1edfce17 | 4 | * @author Tedd OKANO |
okano | 1:90dd1edfce17 | 5 | * @version 0.51(08-Dec-2010) |
okano | 1:90dd1edfce17 | 6 | * |
okano | 0:828a93c038cd | 7 | * This is a very simple demo code of mbeduino + 4x4x4 LED Cube shield |
okano | 0:828a93c038cd | 8 | * |
okano | 0:828a93c038cd | 9 | * mbeduino = http://mbed.org/users/okini3939/notebook/mbeduino/ (Japanese) |
okano | 0:828a93c038cd | 10 | * 4x4x4 LED Cube shield = http://www.galileo-7.com/?pid=20015630 (Japanese) |
okano | 0:828a93c038cd | 11 | * |
okano | 0:828a93c038cd | 12 | * Released under the MIT License: http://mbed.org/license/mit |
okano | 0:828a93c038cd | 13 | * |
okano | 1:90dd1edfce17 | 14 | * revision 0.5 15-Oct-2010 1st release |
okano | 1:90dd1edfce17 | 15 | * revision 0.51 08-Dec-2010 Document reformatted / small modification on main function |
okano | 0:828a93c038cd | 16 | */ |
okano | 0:828a93c038cd | 17 | |
okano | 0:828a93c038cd | 18 | #include "mbed.h" |
okano | 0:828a93c038cd | 19 | #include "LED_Cube444.h" |
okano | 0:828a93c038cd | 20 | |
okano | 0:828a93c038cd | 21 | LED_Cube444 cube; |
okano | 0:828a93c038cd | 22 | |
okano | 0:828a93c038cd | 23 | int main() { |
okano | 0:828a93c038cd | 24 | |
okano | 1:90dd1edfce17 | 25 | cube.set_bits( 0, 0xA5A5 ); |
okano | 1:90dd1edfce17 | 26 | cube.set_bits( 1, 0x5A5A ); |
okano | 1:90dd1edfce17 | 27 | cube.set_bits( 2, 0xA5A5 ); |
okano | 1:90dd1edfce17 | 28 | cube.set_bits( 3, 0x5A5A ); |
okano | 1:90dd1edfce17 | 29 | wait( 0.5 ); |
okano | 1:90dd1edfce17 | 30 | |
okano | 1:90dd1edfce17 | 31 | cube.set_bits( 0, 0x5A5A ); |
okano | 1:90dd1edfce17 | 32 | cube.set_bits( 1, 0xA5A5 ); |
okano | 1:90dd1edfce17 | 33 | cube.set_bits( 2, 0x5A5A ); |
okano | 1:90dd1edfce17 | 34 | cube.set_bits( 3, 0xA5A5 ); |
okano | 1:90dd1edfce17 | 35 | wait( 0.5 ); |
okano | 1:90dd1edfce17 | 36 | |
okano | 1:90dd1edfce17 | 37 | cube.clear(); |
okano | 1:90dd1edfce17 | 38 | |
okano | 0:828a93c038cd | 39 | int v = 1; |
okano | 0:828a93c038cd | 40 | |
okano | 0:828a93c038cd | 41 | while ( 1 ) { |
okano | 0:828a93c038cd | 42 | |
okano | 0:828a93c038cd | 43 | for ( int x = 0; x < 4; x++ ) { |
okano | 0:828a93c038cd | 44 | for ( int y = 0; y < 4; y++ ) { |
okano | 0:828a93c038cd | 45 | for ( int z = 0; z < 4; z++ ) { |
okano | 0:828a93c038cd | 46 | cube.set_bit( x, y, z, v ); |
okano | 0:828a93c038cd | 47 | wait( 0.01 ); |
okano | 0:828a93c038cd | 48 | } |
okano | 0:828a93c038cd | 49 | } |
okano | 0:828a93c038cd | 50 | } |
okano | 0:828a93c038cd | 51 | |
okano | 0:828a93c038cd | 52 | v = !v; |
okano | 0:828a93c038cd | 53 | } |
okano | 0:828a93c038cd | 54 | } |