Difference between revisions of "Energy Shield"
(Created page with "{| style="width: 1000px;" |- | ==Overview== 600px|center Make a energy shield, which can charge automatically when attacked. <br> Suitable...") |
|||
Line 46: | Line 46: | ||
==Programming== | ==Programming== | ||
===Required Program Blocks=== | ===Required Program Blocks=== | ||
− | *[[ | + | *[["Declare as", "variable assignment" program block]] |
− | *[[ | + | *[["If-do" program block]] |
− | *[[ | + | *[["Waiting" program block]] |
− | *[[ | + | *[["Calculation" program block]] |
− | *[[ | + | *[["Text" program block]] |
Line 88: | Line 88: | ||
[[File:mixly-ctrl-game energy-code3.jpg|600px|center]] | [[File:mixly-ctrl-game energy-code3.jpg|600px|center]] | ||
When the distance value is less than 100, for each 100ms, the value of power will reduce 1. When the distance value of line finder A6 is less than 100 (attack comes), the energy value reduce 1, and delay 100ms. | When the distance value is less than 100, for each 100ms, the value of power will reduce 1. When the distance value of line finder A6 is less than 100 (attack comes), the energy value reduce 1, and delay 100ms. | ||
− | Print the energy value out, display the real-time | + | Print the energy value out, display the real-time "energy value%" in serial monitor. |
[[File:mixly-ctrl-game energy-code4.jpg|600px|center]] | [[File:mixly-ctrl-game energy-code4.jpg|600px|center]] | ||
− | When the power is exhausted, if the power value is less than 1 (power is run out), repeat executing: display | + | When the power is exhausted, if the power value is less than 1 (power is run out), repeat executing: display "DEAD" on the computer screen, and turn all LEDs off. |
[[File:mixly-ctrl-game energy-code5.jpg|600px|center]] | [[File:mixly-ctrl-game energy-code5.jpg|600px|center]] | ||
[[File:mixly-ctrl-game energy-code6.jpg|600px|center]] | [[File:mixly-ctrl-game energy-code6.jpg|600px|center]] |
Latest revision as of 10:11, 7 November 2016
ContentsOverviewMake a energy shield, which can charge automatically when attacked.
Module BillModules
Other Equipment
Module SetupSetup
ProgrammingRequired Program Blocks
Programming ThoughtWhen something approaches it, the energy shield will emit energy light, and the shorter the distance is, the stronger the light is.
Start to ProgramDisplay the force value according to the distance
When the distance is less than 100, for every 100ms, the value of power reduces 1. When the distance value of line finder A0 is less than 100(attack comes), the energy value reduces 1, and delay 100ms. When the distance value is less than 100, for each 100ms, the value of power reduces 1, and when the distance value of line finder A2 is less than 100 (attack comes), the energy value reduces 1, and delay 100ms. When the distance value is less than 100, for each 100ms, the value of power will reduce 1. When the distance value of line finder A6 is less than 100 (attack comes), the energy value reduce 1, and delay 100ms. Print the energy value out, display the real-time "energy value%" in serial monitor. When the power is exhausted, if the power value is less than 1 (power is run out), repeat executing: display "DEAD" on the computer screen, and turn all LEDs off. Technical Specification
Related CasesFAQ |