Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Homepage
Code URL¶
https://os.mbed.com/users/mbed_crane_elec/code/Airio-Base_led_sw_test/
Airio-Baseでのスイッチを押すとLEDが点灯するサンプルコードです。
準備¶
本体のみで動作。 追加配線・機器はありません。
SWスイッチ動作¶
SWを押している間、LED1が点灯します。それ以外はなにもありません。
ISPスイッチ動作¶
ISPを押している間、LED2が点灯します。それ以外はなにもありません。
コードについて¶
Airio-Baseの"LED1"は、ポート番号P0_7(またはLED1としてdefineされている)、 "LED2"は、ポート番号P1_13に割り当てられています。これらはサンプルコード
DigitalOut led1(LED1); DigitalOut led2(P1_13,0);
で定義されており、出力デジタルポートとなります。 また、Airio-Baseの"SW"は、ポート番号P1_20、 "ISP"は、ポート番号P0_1に割り当てられています。これらはサンプルコード
DigitalIn sw(P1_20); DigitalIn isp(P0_1);
で定義されており、入力デジタルポートとなります。 スイッチ入力に対するプルアップ処理は10kΩの抵抗が接続されておりハードウェア側で施されていますので、通常ソフトウェア側では意識しなくても構いません。