Robofun 機器人論壇

 找回密碼
 申請會員
搜索
熱搜: 活動 交友 discuz
查看: 5782|回復: 1
打印 上一主題 下一主題

Easy藍牙模組通訊??

[複製鏈接]
跳轉到指定樓層
1#
發表於 2010-3-29 22:31:19 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
請問各位前輩

身上有2塊Easy藍牙模組

但是不知道怎麼互相傳送接收東西(通訊)
還有也不知道怎麼用手機連它

我想做2個東西
1.就是用手機藍牙控制自走車
2.第二台自走車跟隨第一台自走車

我只用過X-Bee模組通訊

問題:
有人可以告訴我兩塊Easy藍牙模組的通訊程式
還有怎麼跟手機溝通嗎?
謝謝
playrobot 該用戶已被刪除
2#
發表於 2010-12-20 11:06:18 | 只看該作者
回復 1# cthunter9434
範例:
' {$STAMP BS2}
' {$PBASIC 2.5}
'
'File: EasySEND.bs2
'
'Purpose: Load on the transmitting unit in the AppNote Easy Bluetooth to Easy Bluetooth Communcation.
'  The example connects to the remote Bluetooth module via serial connection. An address is given to the
'  remote module that the transmitting unit uses to establish connection. 5 seconds after the connection
'  is attempted then a counter variable is sent and incremented by 1 in a repeat loop and then will DEBUG
'  the counter value.
'
'Author: Parallax Technical Support

' ' '' ' '' ' ' Declarations ' ' '' ' '' ' '' ' ''
RX        PIN 2
TX        PIN 0
counter   VAR Byte
'Place the values for each part of the address in the constants below; whereas the first part of the address will be placed in
'addy1 and the second in addy2; for example the address A1:B2:C3:D4:E5:F6 would be edited to look like the following:
'    addy1   CON  $A1     <--- A1 from A1:B2:C3:D4:E5:F6 goes here
'    addy2   CON  $B2     <--- B2 from A1:B2:C3:D4:E5:F6 goes here
'    addy3   CON  $C3     <--- C3 from A1:B2:C3:D4:E5:F6 goes here
'    addy4   CON  $D4     <--- D4 from A1:B2:C3:D4:E5:F6 goes here
'    addy5   CON  $E5     <--- E5 from A1:B2:C3:D4:E5:F6 goes here
'    addy6   CON  $F6     <--- F6 from A1:B2:C3:D4:E5:F6 goes here
' Place the address for the receiving Easy Bluetooth modules below
'( the address for the Easy Bluetooth module used in the example is 00:17:A0:01:56:65 )
     addy1   CON  $00
     addy2   CON  $17
     addy3   CON  $A0
     addy4   CON  $01
     addy5   CON  $56
     addy6   CON  $65
#SELECT $STAMP
  #CASE BS2, BS2E, BS2PE
    Baud       CON     84
  #CASE BS2SX, BS2P
    Baud       CON     240
  #CASE BS2PX
    Baud       CON     396
#ENDSELECT
' ' '' ' '' ' ' Program ' ' '' ' '' ' '' ' ''
Program_Start:
  DEBUG CLS
  PAUSE 3000
  DEBUG CR,"Establishing SPP connection..."
  SEROUT TX, Baud, [$02,$52,$0A,$08,$00,$64,$01,addy6,addy5,addy4,addy3,addy2,addy1,$01,$03]
  PAUSE 5000
  DEBUG CR,"Entering Transparent mode...",CR
  'Entering Transparent mode
  SEROUT TX, Baud, [$02,$52,$11,$01,$00,$64,$01,$03]
  PAUSE 3000
  'Transmitting counter variable to remote Bluetooth device and to the DEBUG terminal
  DO
    SEROUT TX, Baud, [counter]
    counter = counter + 1
    PAUSE 500
    DEBUG ? counter
  LOOP

原廠網址:http://www.parallax.com/StoreSea ... arch=easy+bluetooth
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

小黑屋|手機版|Archiver|機器人論壇 from 2005.07

GMT+8, 2024-11-21 22:17 , Processed in 0.141615 second(s), 8 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表