Difference between revisions of "Key-press"
(→Hardware Buildup) |
(→Debugging) |
||
Line 60: | Line 60: | ||
Step4:Short press or long press the key and you'll see "short" or "long" pressed in the serial monitor every 1s. | Step4:Short press or long press the key and you'll see "short" or "long" pressed in the serial monitor every 1s. | ||
[[File:mixly_Serial_shortlong.jpg|400px|center]] | [[File:mixly_Serial_shortlong.jpg|400px|center]] | ||
+ | |||
=Experiment 2: State Turnover Function= | =Experiment 2: State Turnover Function= | ||
==Overview== | ==Overview== |
Revision as of 14:20, 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. |