LoginSignup
1
1

More than 3 years have passed since last update.

【初めの一歩】Azure Sphereを動かしてみた ~サンプルアプリケーションでLチカ~

Posted at

前回の投稿に引き続き、Azure Sphereの開発ボードを動かした体験を記載していきます。
来年にはGAになることもあり、操作コマンド等の仕様が少し変更されていますが、セットアップについては前回のものでほぼ問題ないです。
もし、OSバージョンが19.10以前のものでSDKをダウンロードしている場合は、最新版をインストールし直したほうがよさそうです。
詳細はこちらです。
https://docs.microsoft.com/ja-jp/azure-sphere/install/install-sdk

サンプルアプリケーションを求めて

セットアップが完了したので、さっそく何か動かしたい気分ということで、ドキュメントからアプリケーションを探してみます。まずは、クイックスタートへ。
https://docs.microsoft.com/ja-jp/azure-sphere/

image.png

まずはAzure Sphereをデバックモードに変更します。

cmd
azsphere device enable-development

[結果]
Getting device capability configuration for application development.
Downloading device capability configuration for device ID '2A30E4922510124B5066456A5511157D7E************7C2973F261C6C7DBA450778F9E70AA8F2720121168E537ECD70EC18CD75CB0719EF45'.
Successfully downloaded device capability configuration.
Successfully wrote device capability configuration file 'C:\Users\TED taiki.ishii\AppData\Local\Temp\tmpF116.tmp'.
Application updates has already been disabled for device.
Enabling application development capability on attached device.
Applying device capability configuration to device.
Successfully applied device capability configuration to device.
The device is rebooting.
Installing debugging server to device.
Deploying 'C:\Program Files (x86)\Microsoft Azure Sphere SDK\DebugTools\gdbserver.imagepackage' to the attached device.
Image package 'C:\Program Files (x86)\Microsoft Azure Sphere SDK\DebugTools\gdbserver.imagepackage' has been deployed to the attached device.
Application development capability enabled.
Successfully set up device for application development, and disabled application updates.
(Device ID: '2A30E492251012***********7D7E6E7C31F22411627CDF60FF34D7C2973F261C6C7DBA450778F9E70AA8F2720121168E537ECD70EC18CD75CB0719EF45')

※このコマンドは以前のSDKバージョンでいうところの「azsphere device prep-debug」です。

デバイスのリブートが完了したら、デバックモードの準備はOK。
次に実行するコードを作成します。
サンプルコードについては以下のGitHubのコードを拝借します。
https://github.com/Azure/azure-sphere-samples
その中でもまずはLチカしたいので、GPIOのサンプルを動かしてみます。
https://github.com/Azure/azure-sphere-samples/tree/master/Samples/GPIO/GPIO_HighLevelApp

まずはローカルにGitのサンプルをダウンロードしてきます。
image.png

次に、READMEに従ってVS2019上でアプリを立ち上げていきます。
image.png
image.png
ソリューションが立ち上がったら、メニューの「ビルド」から「すべてビルド」を実行します。
ビルドが完了したら、ツールバーにある「スタートアップアイテムの選択」のところで「GDB Debugger(HLCore)」を選択します。
image.png

最後にF5キーを押してアプリケーションを実行します。
MicrosoftTeams-image.png
※写真左上のLEDが点滅したらアプリが稼働しています。ちなみに本サンプルはAzure SphereモジュールのAスイッチを押すことで点滅の間隔が変化します。

最後に

今回はサンプルのアプリケーションを動かしたため、何もテクニカルなことをしていませんが、
他のサンプルアプリケーションをもとにAzureにデータを連携する動作も試していきます。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1