Board logo

標題: 新手試試 --- Arduino Bluetooth擴展板套裝 [打印本頁]

作者: zonebaby    時間: 2009-8-18 15:18     標題: 新手試試 --- Arduino Bluetooth擴展板套裝

係網上搵有關E塊板既兩條link,
http://item.taobao.com/auction/i ... 725791bfb2ec6ba.htm
http://www.roboticfan.com/blog/u ... 2009512213936.shtml

睇完發現都唔係好複雜,都試下搞番過無線既藍牙出字。
兩塊藍牙板仔一樣樣都好唔知點分,只係文中提到:
閃得慢係發送主機,閃得快係接收副機,都係要試...
試完就知道板上加左黒點就係發送主機,不過唔知係唔係咁.....

Bluetooth Set
bluetoothset.jpg

圖片附件: bluetoothset.jpg (2009-8-18 15:18, 116.82 KB) / 下載次數 125
https://www.hkepc.com/forum/attachment.php?aid=929121&k=6daaeab301f737fb411e02a6b410de4f&t=1781447022&sid=3NrJfjN6F2


作者: zonebaby    時間: 2009-8-18 15:22

要用E兩塊板最方便係加塊MAX485擴展板,唔係用粒485,不過D接口啱用。
所以塊MAX485擴展板上果3粒jumper都要改位置。

另外原因一樣,因為使用Bluetooth擴展板套裝接口都係會佔用Pin0同1影嚮upload,
所以最好都係先插好Jumpers同埋塊Bluetooth擴展板係塊MAX485擴展板上面,
輪出果塊就插埋D LCD接口....
等upload完至插上去個Arduino道,避免upload失敗。

Bluetooth MAX485
BluetoothMAX485.jpg

圖片附件: BluetoothMAX485.jpg (2009-8-18 15:22, 92.47 KB) / 下載次數 126
https://www.hkepc.com/forum/attachment.php?aid=929123&k=9657cf6c0531a7de22b3885f4ff9d52e&t=1781447022&sid=3NrJfjN6F2


作者: zonebaby    時間: 2009-8-18 15:22

測試方式係由一部Arduino連續不停地發送'Hello! Arduino  ','BlueTooth Testing  '。
信息一方面經Bluetooth存送到另一部Arduino,
另一方面亦可以係PC用hyperterminal經USB進行鑑察。

另一部Arduino會負責接收。收到就會直接出LCD顕示出來,唔再用串行輸出。

兩部Arduino可以分開唔需要連接在一起。

Bluetooth MAX485 Arduino
BluetoothMAX485Arduino.jpg

圖片附件: BluetoothMAX485Arduino.jpg (2009-8-18 15:22, 87.15 KB) / 下載次數 434
https://www.hkepc.com/forum/attachment.php?aid=929124&k=a1dcffa5d625b52852eb9e81f5ec2b65&t=1781447022&sid=3NrJfjN6F2


作者: zonebaby    時間: 2009-8-18 15:22

發送code
  1. void setup()
  2. {
  3.   Serial.begin(115200);
  4. }

  5. void loop()
  6. {
  7.     Serial.print("Hello! Arduino  ");
  8.     delay(200);
  9.     Serial.print("BlueTooth Testing  ");
  10.     delay(500);       
  11. }
複製代碼

作者: zonebaby    時間: 2009-8-18 15:22

接收code
  1. // include the library code:
  2. #include <LiquidCrystal.h>

  3. // initialize the library with the numbers of the interface pins
  4. LiquidCrystal lcd(13, 11, 7, 6, 5, 4);

  5. void setup()
  6. {
  7.   // set up the LCD's number of rows and columns:
  8.   lcd.begin(16, 2);
  9.   // Print a welcome message to the LCD.
  10.   lcd.print("hello, world!");
  11.   // Print a message to the LCD.
  12.   // set the cursor to column 0, line 1
  13.   // (note: line 1 is the second row, since counting begins with 0):
  14.   lcd.setCursor(0, 1);
  15.   Serial.begin(115200);
  16. }

  17. void loop()
  18. {
  19.    char val;
  20.    val = Serial.read();
  21.    
  22.    if(val!=-1)
  23.     {
  24.         // serial send received char:
  25.         lcd.print(val);
  26.      }
  27. }
複製代碼

作者: zonebaby    時間: 2009-8-18 15:22

E兩個Code都係放在examples\BlueToothV2入面....

Bluetooth Location
bluetoothlocation.gif

Compile同upload成功後,分別插番兩塊MAX485擴展板,再插番兩個USB就可以試機。
不過要小心唔好掉轉兩塊板。
插左電等一陣,BlueTooth上面既LED就會變成常亮代表完成配對可以開始通訊。
並開始由一部Arduino連續不停地發送Hello! Arduino BlueTooth Testing...到另一部Arduino。
另一部Arduino收到後就會係LCD顯示出來。

Bluetooth Success
bluetoothsuccess.jpg

同時亦可以睇用個hyperterminal睇下另一部Arduino既發送情況。

Bluetooth Terminal
BluetoothTerminal.gif

Bluetooth擴展板試機成功.......

圖片附件: bluetoothlocation.gif (2009-8-18 15:22, 33.42 KB) / 下載次數 117
https://www.hkepc.com/forum/attachment.php?aid=929125&k=63a519680fb2b582ab6877dc03bbe23d&t=1781447022&sid=3NrJfjN6F2



圖片附件: bluetoothsuccess.jpg (2009-8-18 15:22, 91.21 KB) / 下載次數 138
https://www.hkepc.com/forum/attachment.php?aid=929126&k=ae3b28d71f6206ee800cf7a8804c490a&t=1781447022&sid=3NrJfjN6F2



圖片附件: BluetoothTerminal.gif (2009-8-18 15:22, 18.19 KB) / 下載次數 165
https://www.hkepc.com/forum/attachment.php?aid=929127&k=c994f2349e470c8482fc9fedce84b620&t=1781447022&sid=3NrJfjN6F2


作者: zonebaby    時間: 2009-8-18 15:22

後記:暫時未有...
作者: jackli    時間: 2009-8-18 20:21

整出黎比你玩果個先覺得複雜嫁嘛





歡迎光臨 電腦領域 HKEPC Hardware (https://www.hkepc.com/forum/) Powered by Discuz! 7.2