Reputation: 21
Is it possible to create an application with Mono for Android and control Arduino without using Eclipse but using Visual Studio and C#?
I checked some examples but everyone uses Java and Eclipse.
Upvotes: 1
Views: 1400
Reputation: 14336
Simply put, the answer is yes, it is possible. The real question is: How? I'm going to assume you've already written you first Android app with Mono.
Next, you need to decide how you will connect your Android device to the Arduino. Bluetooth? Wi-Fi? Web?
Next, it's simply a matter of using the appropriate Android API. Check out the Xamarin documentation for Android.
Update
Much more than what I present below is available with the ported MonoDroid sample applications. Specifically, you would be interested in the BluetoothChat example.
Make sure you also take a look at adding permissions to the manifest file, and of course, the Android Developer Guide for Bluetooth.
That said, here's a tiny something to get you started, based on Android Quick Look: 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;
}
Upvotes: 2