新手試試 --- Arduino Bluetooth擴展板套裝

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

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

Bluetooth Set
bluetoothset.jpg

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

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

Bluetooth MAX485
BluetoothMAX485.jpg

TOP

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

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

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

Bluetooth MAX485 Arduino
BluetoothMAX485Arduino.jpg

TOP

發送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. }
複製代碼

TOP

接收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. }
複製代碼

TOP

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擴展板試機成功.......

TOP

後記:暫時未有...

TOP

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

TOP