关于arduino编程控制android/iphone 手机的方案如 Amarino
本帖最后由 hick 于 2013-9-11 12:34 编辑搜索 android arduino 资料,看了一圈,很多都是从 android 控制 arduino 的。 貌似 Amarino 这个比较靠谱:
Amarino is a toolkit to connect Android-driven mobile devices with Arduino microcontrollers via Bluetooth. The toolkit provides easy access to internal phone events which can be further processed on the Arduino open-source prototyping platform.
这句话我理解主要是 arduino 去操作 android , 应该是是操作各种 android 机组件,比如摄像头、sd卡、gps等各种手机传感器---没确认目前支持的传感器列表,原理应该很简单,就是连接蓝牙以后,通过串口通信交流指令。我理解不难实现,我都想自己搞个 python 版的类似桥接工具了。
/*
* Receives compass sensor events from your phone.
*/
#include <MeetAndroid.h>
MeetAndroid meetAndroid(error);
void error(uint8_t flag, uint8_t values){
meetAndroid.send("ERROR: ");
meetAndroid.send(flag);
}
void setup() {
Serial.begin(57600);
meetAndroid.registerFunction(compass, 'A');
}
void loop() {
meetAndroid.receive(); // you need to keep this in your loop() to receive events
}
/*
* Compass events are sent several times a second.
* therefore this method will be called constantly.
*
* note: flag is in this case 'A' and numOfValues is 1
* since compass event sends exactly one single int value for heading
*/
void compass(byte flag, byte numOfValues) {
// we use getInt(), since we know only data between 0 and 359 will be sent
int heading = meetAndroid.getInt();
doSomethingUseful(heading);
}
目前看官方资料, 貌似除了上面的实现,也支持 android 机上去操作 arduino .
还有没有更好的方案? 对利用废旧 android 手机非常感兴趣! 原先个人是想拆解利用手机传感器,了解一圈以后感觉很困难。感觉 amarino 这个方案不错, 以后可以考虑收集 android 机做各种事了。
有兴趣的一起学习交流哈, 可以加我微信: hickwu --- 请注明 arduino-android , 也可在我 blog 留言交流: http://blog.hickwu.com/posts/282 方案,要么走WIFI 要么走蓝牙。其他的都只是从APP数据回传给Arduino。控制手机有啥好玩,返过来控制还有点意思。。
wyd1520 发表于 2013-9-11 13:43 static/image/common/back.gif
方案,要么走WIFI 要么走蓝牙。其他的都只是从APP数据回传给Arduino。控制手机有啥好玩,返过来控制还有点意 ...
我拿 amarino 说方案不是说走什么通信哈,要 amarino 那样的是提供编程接口的方案。
我是做遥控小车的时候,感觉控制手机传感器很实用; 另外后两年肯定会出现大量的淘汰下来的 android 手机, 怎么利用不仅仅是兴趣问题,而且很有市场.
像 amarino 提供的,我现在理解就是双向控制。 现在基本是走蓝牙的方式,个人理想化里,应该把蓝牙的通信方式抽象出来,作为协议层,以驱动的方式支持各种协议, 包括 wifi 就牛了。 hick 发表于 2013-9-11 14:12 static/image/common/back.gif
我拿 amarino 说方案不是说走什么通信哈,要 amarino 那样的是提供编程接口的方案。
我是做遥控小车 ...
就遥控小车来说,如果你想用到手机的传感器,一般都会把手机和小车放在一起。如果这样的话,再通过蓝牙来让手机和arduino小车通信,有点费电。
不如直接通过OTG线、或者音频线连接android、arduino来的直接。
你介绍的Amarino是个不错的东东,它大大简化了android传感器编程 shytian 发表于 2013-9-11 20:07 static/image/common/back.gif
就遥控小车来说,如果你想用到手机的传感器,一般都会把手机和小车放在一起。如果这样的话,再通过蓝牙来 ...
OTG 之前听说过, 我的魅族 M9 不支持。
音频线这个貌似不错,想起来见过有人做过类似组件。多谢提醒,嘿嘿 但amarino有个问题,在android的amarino类库中没有接收arduino的方法
luochen_2011 发表于 2013-9-14 11:08 static/image/common/back.gif
但amarino有个问题,在android的amarino类库中没有接收arduino的方法
不会吧, 倒是没仔细看,好像示范程序中有从手机端操作的。
从原理性上,有了通信渠道了自己捣腾也不是很麻烦。
页:
[1]