FrontPage

Leonardo Button Mouse Control Example

Leonardo ボタンマウスの制御例

When a button is pressed in this example, a mouse cursor movement is sent to the computer as if you had moved your mouse.

この例では、ボタンが押されると、あたかもマウスを動かしたかのように、マウスカーソルの動きがコンピュータに送られます。

Four buttons are used to send mouse movements of up, down, left, and right, and a fifth button is used to send a left mouse-button click.

4つのボタンで上下左右のマウス操作を行い、5つ目のボタンでマウスの左ボタンのクリックを行います。

Start by building the circuit. You’ll need five pushbuttons, as shown in Figure 6-1.

まず、回路を作るところから始めましょう。図6-1に示すように、5つの押しボタンが必要です。

As usual, open a new sketch in the Arduino IDE.

いつものように、Arduino IDEで新しいスケッチを開きます。

Name your sketch Button Mouse Control, and type the Example 6-2 code into Arduino.

スケッチの名前を「Button Mouse Control」にして、例6-2のコードをArduinoに入力します。

You can also download it from the example code link on the book’s catalog page, or open File→Examples→09.USB→Mouse→Button Mouse Control in the IDE.

また、書籍のカタログページにあるサンプルコードのリンクからダウンロードするか、IDEでFile→Examples→09.USB→Mouse→Button Mouse Controlを開くこともできます。

Upload the sketch, and then press the movement buttons (the ones attached to pins 2, 3, 4, or 5) one at a time.

スケッチをアップロードしてから、動作ボタン(2、3、4、5番ピンについているボタン)を1つずつ押していきます。

You should see the cursor on your computer move around.

パソコンのカーソルが動くのを確認してください。

Move the cursor over a partially hidden window and press the button that corresponds to clicking the left mouse-button.

部分的に隠れているウィンドウにカーソルを合わせて、マウスの左ボタンをクリックしたときに対応するボタンを押します。

The hidden window should be brought to the front.

隠れていた窓を前面に出すべきだ。

トップ   編集 凍結解除 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2021-11-30 (火) 10:12:24