Difference between revisions of "Key-press"
(Created page with "{| style="width: 800px;" |- | =Function of the Module= *'''Please refer to:Crash Sensor''' ===Equipment=== {|class="wikitable" |- |Module||Number||Function |- |mCookie-C...") |
(→Function of the Module) |
||
Line 3: | Line 3: | ||
| | | | ||
=Function of the Module= | =Function of the Module= | ||
− | *'''Please refer to:[[Crash Sensor]]''' | + | *'''Please refer to:[[The Use of Crash Sensor]]''' |
===Equipment=== | ===Equipment=== | ||
{|class="wikitable" | {|class="wikitable" | ||
Line 23: | Line 23: | ||
[[File:Crash-module.jpg|center|600px]] | [[File:Crash-module.jpg|center|600px]] | ||
+ | |||
=Example 1: Long-press & Short-press Function= | =Example 1: Long-press & Short-press Function= | ||
==Overview== | ==Overview== |
Revision as of 05:48, 23 March 2016
ContentsFunction of the Module
Equipment
Example 1: Long-press & Short-press FunctionOverviewTo detect the key is long pressed or short pressed, which can be distinguished by checking the returned results in the serial monitor. Hardware Buildup
Mixly Programming
DebuggingStep1:Select the right board card(Core USB 32U4) and COM port(Recognized automatically by default). Step2:Open the serial monitor. Step3:Make sure the serial baud rate is the same with the pre-set one. Step4:Short press or long press the key and you'll see "short" or "long" pressed in the serial monitor every 1s. Experiment 2: State Turnover FunctionOverviewEach time you press down a key, the status will turn over once. Like a desk lamp, when you press down, it turns on. And press one more time, it'll turn off. There're only two states. We can see the result through the serial monitor. Pressing down means "ON" (print "ON" in the serial monitor)and one more time, means "OFF"("OFF" printed in the serial monitor). Hardware Buildup
Mixly Programming
DebuggingStep1:Select the right board card(Core USB 32U4) and COM port(Recognized automatically by default). Step2:Open the serial monitor. Step3:Make sure the serial baud rate is the same with the pre-set one. Step4:Short press the key once and you'll see "ON' printed in the serial monitor. Press down again and you'll see "OFF" printed. ExtensionBy changing the serial port print to the colored lights, you can DIY a little desk lamp. |