2013-03-27 57 views

回答

2

简单地说,答案是肯定的,这是可能的。真正的问题是:如何?我假设你已经有written you first Android app with Mono

接下来,你需要决定你将如何将Android设备连接到Arduino。 BluetoothWi-Fi?网?

其次,它只是使用适当的Android API的问题。检查出Xamarin documentation for Android

更新

很多比我下面要介绍更多的是可用的ported MonoDroid sample applications。具体来说,你会对BluetoothChat example感兴趣。

确保你也看看adding permissions清单文件,当然,在Android Developer Guide for Bluetooth

这就是说,这里有一个小小的东西,让你开始,基于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; 
} 
+0

谢谢来回答案。是的,我已经在使用服务器进行数据传输的单声道应用程序。我更喜欢与蓝牙连接...我检查了类,我注意到[Android.Bluetooth](http://androidapi.xamarin.com/index.aspx?link=root%3a%2fMonoAndroid-lib)类(我没有但是我的“恐惧”是因为我无法在google中找到任何例子,所以为什么我问你是否尝试过使用mono + arduino做过一个项目 – Pennas 2013-03-27 10:51:07

+0

我知道这不是'您可能想要了解如何使用Android API(Java)以及C#中的等效代码,如果您愿意,可以在几个小时内发布示例代码你已经使用蓝牙与Arduino了吗? – 2013-03-27 11:42:55

+0

没有尝试过,我已经将它控制为.exe(windows窗体应用程序)并手动使用LCD屏幕,我的下一步是用蓝牙诚实地控制它。我正在使用C#来创建连接,我不知道我是否可以像android应用程序一样使用单声道droid ..(所以任何例子它将是非常有用的)。预先感谢您 – Pennas 2013-03-27 12:06:22

相关问题