Outline
Make a neon lamp, or named marquee, and makes 6 LEDs flash in turn.
Suitable kits: mCookie102, mCookie202, mCookie302
Module Bill
Module
Other Equipment
- USB cable*1
- Sensor shell*1
- Lego or other fixation structure
Module Setup
Look at the New Module
6 LED matrix
mCookie-LED Matrix module integrates 6 lamp beads. Each has a built-in IC control chip, and the brightness state of the six can be controlled by one interface. It can be used as a full-color module set to provide light source.
- Assemble the modules and sensors:
- Stick the red core module, USB upload module and green 6 LED matrix module together;
- Insert one end of the USB cable into USB upload module, and connect the other to computer.
Programming
Required Program Blocks
“LED prepare” program block
“LED control” program block
“Delay” program block
“Every time” program block
“Calculate” program block
Programming Thought
The arrange of the 6 LEDs of the matrix.
In order to implement neon lamp effect, we need to make the 6 LEDs flash in order.
Start Programming
1. LED prepare, controls the first 3 LEDs to light in order of which the numbers are 1,3,5.
2. Control the last 3 LEDs to light in order the number of which are 6, 4, 2.
- Test the result
- After upload, you can see the LEDs run in order!
Q: The program seems too long, is there some way to simplify it?
A: The required new program blocks are “Every time” program block and “Calculate” program block
- Thought:
- Variable i varies from 1to 3, and the corresponding LED numbers are 1, 3, 5. Variable i varies from 3 to 1, and the corresponding LED numbers are 6, 4, 2. Find out the relationship between variable i and the LED number.
1. LED prepare, and control the first 3 LEDs with every time program block.
2. Then use the every time program block to control the last 3 LEDs.
Technical Specification
Related Cases
Q&A
Q: Are the LEDs in 6 LED matrix all same?
A: Yes, they are. The 6 LED matrix is equivalent to cascading six LEDs.
|