Android用のMonoでアプリケーションを作成し、Eclipseを使用せずにVisual StudioとC#を使用してArduinoを制御することは可能ですか?
いくつかの例を確認しましたが、誰もがJavaとEclipseを使用しています。
Android用のMonoでアプリケーションを作成し、Eclipseを使用せずにVisual StudioとC#を使用してArduinoを制御することは可能ですか?
いくつかの例を確認しましたが、誰もがJavaとEclipseを使用しています。
簡単に言えば、答えはイエスです、それは可能です。本当の問題は:どうやって?すでにMonoを使用した最初のAndroidアプリを作成していると仮定します。
次に、AndroidデバイスをArduinoに接続する方法を決定する必要があります。Bluetooth?Wi-Fi?ウェブ?
次に、適切なAndroidAPIを使用するだけです。Android用のXamarinドキュメントを確認してください。
アップデート
移植されたMonoDroidサンプルアプリケーションでは、以下に示すものよりもはるかに多くのものを利用できます。具体的には、BluetoothChatの例に関心があります。
マニフェストファイルへのアクセス許可の追加、そしてもちろん、 Bluetooth用Android開発者ガイドも確認してください。
そうは言っても、 Androidクイックルックに基づいた小さなものがあります:BluetoothAdapter :
txtStatus.Text = "Getting Bluetooth adapter...";
BluetoothAdapter bluetooth = BluetoothAdapter.DefaultAdapter;
if( bluetooth == null )
{
txtStatus.Text = "No Bluetooth adapter found.";
return;
}
txtStatus.Text = "Checking Bluetooth status...";
if (!bluetooth.IsEnabled )
{
Toast.MakeText(this, "Bluetooth not enabled. Enabling...",
ToastLength.Short).Show();
bluetooth.Enable();
}
if (bluetooth.State == State.On)
{
txtStatus.Text =
"State: " + bluetooth.State + System.Environment.NewLine +
"Address: " + bluetooth.Address + System.Environment.NewLine +
"Name: " + bluetooth.Name + System.Environment.NewLine;
}
else
{
txtStatus.Text = "State: " + bluetooth.State;
}