Difference between revisions of "Multi-Functional Flashlight"
(→Related Cases) |
|||
Line 41: | Line 41: | ||
*Assemble the modules and sensors together: | *Assemble the modules and sensors together: | ||
**Stick the red core modules, USB upload module and green extension module together; | **Stick the red core modules, USB upload module and green extension module together; | ||
− | **Connect the red LED to pin | + | **Connect the red LED to pin 6/7 of Hub; |
**Connect the crash to pin 4/5 of Hub; | **Connect the crash to pin 4/5 of Hub; | ||
**Insert one end of USB cable into the USB upload module, and connect the other to computer; | **Insert one end of USB cable into the USB upload module, and connect the other to computer; | ||
Line 48: | Line 48: | ||
==Programming== | ==Programming== | ||
===Required Program Blocks=== | ===Required Program Blocks=== | ||
− | *[[ | + | *[["Digital write" program block]] |
− | *[[ | + | *[["Crash button" program block]] |
Line 56: | Line 56: | ||
[[File:mixly-ctrl-flashlight.jpg|600px|center]] | [[File:mixly-ctrl-flashlight.jpg|600px|center]] | ||
===Programming=== | ===Programming=== | ||
− | + | 1. '''Switch 4 is pressed, then LED 6 emits strong light''' | |
<br> | <br> | ||
− | Set the pin of | + | Set the pin of "crash button" program block to 4, and the state to press; set the "analog output" pin to 6, and assign 255 to it; set delay to 1000ms. |
[[File:mixly-ctrl-flashlight-code1.jpg|600px|center]] | [[File:mixly-ctrl-flashlight-code1.jpg|600px|center]] | ||
− | + | 2. '''Switch 4 is pressed, and the LED 6 emits weak light.''' | |
<br> | <br> | ||
− | Set the pin of crash to 4, and the state to press; set the pin of program block of | + | Set the pin of crash to 4, and the state to press; set the pin of program block of "analog write" to 6, and assign 50 to it; delay 1000ms. |
[[File:mixly-ctrl-flashlight-code2.jpg|600px|center]] | [[File:mixly-ctrl-flashlight-code2.jpg|600px|center]] | ||
3、'''Switch 4 is pressed, and the LED 6 goes off.''' | 3、'''Switch 4 is pressed, and the LED 6 goes off.''' | ||
<br> | <br> | ||
− | Set the pin of | + | Set the pin of "crash button" program block to 4, and the state to press; set the pin of "analog write" program block to 6, and assign 0 to it; delay 1000ms. |
[[File:mixly-ctrl-flashlight-code3.jpg|600px|center]] | [[File:mixly-ctrl-flashlight-code3.jpg|600px|center]] | ||
4. So link the program blocks together, and choose the core and port to download program. | 4. So link the program blocks together, and choose the core and port to download program. |
Latest revision as of 10:27, 9 October 2016
ContentsOutlineMake a multi-functional flashlight, which can be lighting, and the brightness is adjustable. Suitable kits: mCookie102, mCookie202, mCookie302, IBC
Module BillModule
Other Equipment
Module Setup
ProgrammingRequired Program Blocks
Programming ThoughtPress the switch, the light is the most bright; press again, the light gets dark; press the third time, the light goes off. Adjust the brightness of the flashlight through “switch”. Programming1. Switch 4 is pressed, then LED 6 emits strong light
2. Switch 4 is pressed, and the LED 6 emits weak light.
3、Switch 4 is pressed, and the LED 6 goes off.
4. So link the program blocks together, and choose the core and port to download program.
Technical Specification
Related CasesQ&A |