Getting back to this next example, if you have just one pushbutton, how do you control the brightness of a lamp?
次の例ですが、押しボタンが1つしかない場合、ランプの明るさをどのように制御するのでしょうか。
You're going to learn yet another Interaction Design technique:
また新たなインタラクションデザインの手法を学ぶことになります。
detecting how long a button has been pressed.
ボタンをどれだけ押したかを検知する。
To do this, we need to upgrade Example 4-5 from Chapter 4 to add dimming.
そのためには、第4章の例4-5をバージョンアップして、調光機能を追加する必要があります。
The idea is to build an interface in which a press-and-release action switches the light on and off, and a press-and-hold action changes brightness.
それは、押して離す動作で照明のオン・オフを切り替え、押して離さない動作で明るさを変えるというインターフェースを構築することです。
Have a look at the sketch in Example 5-2.
例5-2のスケッチを見てみましょう。
It turns on the LED when the button is pressed and keeps it on after it is released.
ボタンを押すとLEDが点灯し、離すと点灯したままになります。
If the button is held, the brightness changes.
ボタンを長押しすると、明るさが変化します。