ãAndroid端æ«ã¨mbedãBluetooth SPPã§æ¥ç¶ããå®é¨ããã¾ããã®ã§ããã®æé ãã¾ã¨ãã¦ã¿ã¾ããã
ã以å使ã£ã¦ãã”myBlueUSB”ã¯ãæè¿ãã¾ãã³ã³ãã¤ã«ã§ããªããªã£ã¦ãã¾ã£ããããªã®ã§ã”Norimasa Okamoto”ãããå
¬éãã¦ãã ãã£ã¦ãã”BTstack”ã使ã£ã¦ã¿ã¾ããã
ããã®è¨äºã¯ãããç¨åº¦Androidãmbedã®éçºçµé¨ãããæ¹ã対象ã«ãã¦ãã¾ãã®ã§ããã¼ã«é¡ã®æä½æ¹æ³ã®ç´°ãã説æã¯çç¥ãã¦ãã¾ãã
ï¼ï¼å¿
è¦ãªãã®
ãã»mbedå´
ï¼ï¼ï¼mbedãNXP LPC1768
ãã
ï¼ï¼ï¼StarBoard Orange ã¾ãã¯ãUSBã³ãã¯ã¿ï¼Aã¿ã¤ã ã¡ã¹ ï¼
ãStarBoard Orangeã§ã¯ãªããUSBã³ãã¯ã¿ï¼Aã¿ã¤ã ã¡ã¹ ï¼ã ãã§ãè¯ãã§ãããã¡ãã§è©³ç´°ã«è§£èª¬ããã¦ãã¾ãã®ã§åèã«ãã¦ãã ããã
ããã
ãããã
ï¼ï¼ï¼BTstackã
ãmbedã§Bluetoothã使ããããã«ããã©ã¤ãã©ãªã§ãã
ã詳細ã¯ãã¡ãã
ï¼ï¼ï¼Windows serial port driver
ãmbedå´ã®åä½ç¢ºèªãããã®ã«ä¾¿å©ã§ãã
ï¼ï¼ï¼USB Bluetoothãã³ã°ã«
ãç§ãåä½ç¢ºèªããã®ã¯ããã§ãã
ããiBUFFALO Bluetooth4.0+EDR/LEå¯¾å¿ USBã¢ããã¿ ãã©ã㯠BSHSBD08BK
ãã»Android端æ«å´
ï¼ï¼ï¼Android端æ«
ãç§ãåä½ç¢ºèªããã®ã¯ä»¥ä¸ã®äºã¤ã§ãã
ããGoogle Nexus 7
ããacer ICONIA TAB A500
ï¼ï¼ï¼Androidéçºç°å¢
ããAndroidãSDK
ï¼ï¼ï¼GetBlue
ãAndroidéçºç°å¢ãä½ãã®ãé¢åãªã¨ãã¯ãããã®ç¡æçã§ãå®é¨ã§ãã¾ãã
ï¼ï¼mbedå´ã®æºå
ï¼ï¼ï¼Windows serial port driverãã¤ã³ã¹ãã¼ã«ããã·ãªã¢ã«ç«¯æ«ã使ããããã«ãã¦ããã¾ãã
ããmbedãåºåãããã°ãè¦ããã®ã§ãããã¨ä¾¿å©ã§ãããã°ã®éä¿¡é度ã¯921600bpsã§ãã
ï¼ï¼ï¼BTstackã®ã¤ã³ãã¼ã
ãBTstackãã³ã³ãã¤ã©ã«ã¤ã³ãã¼ããã¾ãã
"spp_demo.cpp"ã使ç¨ããã®ã§ã以ä¸ã®ä¿®æ£ããã¾ããï¼2014.03.12 追è¨ï¼
ã”mouse_demo.cpp”ã®1è¡ç® #if 1 ã¼ã¼ã¼ï¼ã#if 0
"spp_demo.cpp"ã®1è¡ç® #if 0 ã¼ã¼ã¼ï¼ã#if 1
ï¼ï¼ï¼ã³ã³ãã¤ã«ï¼ãã¦ã³ãã¼ã
ãã³ã³ãã¤ã«ãã¦mbedã«ãã¦ã³ãã¼ããã¦ããã¾ãã
ï¼ï¼Android端æ«å´ã®æºå
ãã»Androidéçºç°å¢ã使ãå ´åã
ãAndroid SDKä»å±ã®BluetoothChatã使ç¨ãã¾ãã
ããããåèã«"BluetoothChatService.java"ã®UUIDãæ¸ãæãã¦ãã端æ«ã«ãã¦ã³ãã¼ããã¦ããã¾ãã
ãç§ã使ã£ãBluetoothChatã¯Android2.2ç¨ã§ãã
ãA500ã¯Android3.0ã§ãããAndroid3.0ç¨BluetoothChatã¯ãUUIDã®å®ç¾©é¨åãã¡ãã£ã¨ç°ãªã£ã¦ããã®ã§Android2.2ç¨ã使ãã¾ããã
ãã»GetBlueã使ãå ´åã
ã GetBlueã端æ«ã«ãã¦ã³ãã¼ãï¼ã¤ã³ã¹ãã¼ã«ãã¦ããã¾ãã
ï¼ï¼æ¥ç¶å®é¨
ããã¢ãªã³ã°ãSPPæ¥ç¶ããåã«ãAndroid端æ«ã®Bluetoothè¨å®ã§”æ¤åºå¯è½”ã«ãã¦ããã¾ãã
ãã»Nexus 7ã®ã¨ã
ã
ãã»ICONIA TAB A500ã®ã¨ã
ã
ãã»Androidéçºç°å¢ã使ãå ´åã
ï¼ï¼ï¼ã¾ãAndroid端æ«ã¨mbedããã¢ãªã³ã°ãã¾ãã
ãPINã³ã¼ããèããã¦ããã¨ã㯔0000”ã§ãã
ï¼ï¼ï¼ã¤ãã«BluetoothChatãèµ·åãã¾ãã
ï¼ï¼ï¼ã¡ãã¥ã¼ãã¿ã³ãæ¼ãã¨ã”connect a device”ã¨è¡¨ç¤ºãããã®ã§ãããé¸æããå
ã»ã©ãã¢ãªã³ã°ããmbedãæå®ãã¾ããããã§mbedã¨æ¥ç¶ã§ããã¯ãã§ãã
ï¼ï¼ï¼mbedã¨ã®æ¥ç¶ããã¾ããã£ã¦ããã°ãAndroid端æ«ããéä¿¡ãããã®ãã¨ã³ã¼ããã¯ããã¦ãã¾ãã
ã
ãã»GetBlueã使ãå ´åã
ï¼ï¼ï¼ã¾ãAndroid端æ«ã¨mbedããã¢ãªã³ã°ãã¾ãã
ãPINã³ã¼ããèããã¦ããã¨ã㯔0000”ã§ãã
ï¼ï¼ï¼ã¤ãã«GetBlueãèµ·åãã¾ãã
ï¼ï¼ï¼ã¡ãã¥ã¼ãã¿ã³->settings->Datasource(Input)->Bluetoothãé¸æããå
ã»ã©ãã¢ãªã³ã°ããmbedãæå®ãã¾ããã¡ãã¥ã¼ç»é¢ãæãã¦ã¹ã¿ã¼ããã¿ã³ãæ¼ãã¨mbedã«æ¥ç¶ã§ããã¯ãã§ãã
ã注æï¼Datasink(Output)ã«ã¯ä½ãè¨å®ãã¾ããã
ï¼ï¼ï¼mbedã¨ã®æ¥ç¶ããã¾ããã£ã¦ããã°ãAndroid端æ«ããéä¿¡ãããã®ãã¨ã³ã¼ããã¯ããã¦ãã¾ãã
ï¼ï¼è£è¶³ï¼
ãWindows PCã¨æ¥ç¶ãããå ´åã
ãmbedã¨PCããã¢ãªã³ã°ããã¨PCå´ã«COMãã¼ããå²ãå½ã¦ãããã®ã§ããã¨ã¯ãããæ®éã«ã·ãªã¢ã«ãã¼ãã¨ã㦔Tera Term”çã§éãã¯éä¿¡ã§ãã¾ãã
ï¼ï¼è£è¶³ï¼ ï¼2014.03.12 追è¨ï¼
ãWindows PCã¨ã®SPPæ¥ç¶ã«ã¤ãã¦ã
ãWin7ã®æã¯ãã¾ãæ¥ç¶ã§ãã¦ããã®ã«ãWin8ã«ãã¦ãããã¾ããããªããªã£ã¦ãã¾ãã¾ããã
ããã¢ãªã³ã°ã¯ã§ããã®ã§ãããTeraTermããæ¥ç¶ãããã¨ããã¨ã¨ã©ã¼ã«ãªãã¾ãã
ãBluetoothã®ãã©ã¤ãã¯ãWin7ã®æã¯ãã³ã°ã«ä»å±ã®ç©ãWin8ã§ã¯Win8æ¨æºã®ç©ã使ç¨ãã¦ã¾ãã
ãã³ã°ã«ä»å±ã®Win7ç¨ãã©ã¤ããWin8ã§è©¦ããã®ã§ãããã©ã¤ããæ£å¸¸ã«åä½ãã¾ããã§ããã
ãWin8ã§ããã³ã°ã«ä»å±ã®Win8ç¨ãã©ã¤ããããã°ãã¾ãããã®ããããã¾ããã試ãã¦ãã¾ããã
ãAuduino ï¼ USBãã¹ãã·ã¼ã«ãã§ã試ãã¾ããããããNGã
ãSBDBTã®SPPã¯Win8ã§ããã¾ãããã¾ããã
âã以ä¸ãï¼
é¢é£ããè¨äº
ã»Android端æ«ã¨mbedãBluetooth SPPã§æ¥ç¶ããå®é¨(myBlueUSBç·¨)