TA的每日心情 | 衰 2013-12-4 00:00 |
---|
签到天数: 47 天 连续签到: 1 天 [LV.5]常住居民I
|
搜索 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
|
|