作者: zonebaby 時間: 2009-9-27 13:10 標題: 新手試試 --- PC BlueTooth USB Dongle to Arduino BlueTooth with LCD Display 試作
上次試過兩個 Arduino 用 BlueTooth 主從方式單向發訊,今次就由PC向 Arduino 發訊,
所以塊 BlueTooth 板仔要用從屬果塊。塊板就用番上次果塊加一個大D既 LCD Display,
同埋加多個 Bluetooth 2 既 USB Dongle 連接PC。
PC BlueTooth USB Dongle to Arduino BlueTooth
https://h2.hkepc.com/forum/attachment.php?aid=949038&k=001d0d953a06ce9c7723341cc8c2514c&t=1781441225&sid=13lm4A3qwEr

作者: zonebaby 時間: 2009-9-27 13:20
用個舊code改左少少。
- // include the library code:
- #include <LiquidCrystal.h>
- // initialize the library with the numbers of the interface pins
- LiquidCrystal lcd(13, 11, 7, 6, 5, 4);
- void setup()
- {
- pinMode(3,OUTPUT);
- digitalWrite(3,HIGH);
- // set up the LCD's number of rows and columns:
- delay(1000);
- lcd.begin(20, 4);
- // Print a message to the LCD.
- lcd.print("OK");
- // Print a message to the LCD.
- // set the cursor to column 0, line 1
- // (note: line 1 is the second row, since counting begins with 0):
- lcd.setCursor(0, 0);
- Serial.begin(115200);
- }
- void loop()
- {
- char val;
- val = Serial.read();
- if(val!=-1)
- {
- // serial display received char:
- lcd.print(val);
- }
- }
作者: zonebaby 時間: 2009-9-27 13:21
插個 BlueTooth USB Dongle 去PC到就會自己認到同裝個 Driver。
係系統匣就會見到個icon,
BlueTooth icon
係個Device Manager就見到 Bluetooth Radios 同埋 Bluetooth Networks。
Bluetooth Radios
Bluetooth Networks
跟住就用Add Bluetooth Device去搵個 Arduino BlueTooth。
冇個icon,就去control panelel搵或者用Run bthprops.cpl 都可以。
Add Bluetooth Device
個 Bluetooth UI 就會彈出來
Bluetooth UI
按 Add 就會準備搜索程序。
但繼續前必須完成拔走個 Bluetooth,compile同upload左個code去 Arduino 到
就再插返個 BlueTooth,然後接電源。
Adding Bluetooth Wizard
個 LCD Display 見到OK,就可以繼續。搵到就會見到個 Arduino BlueTooth 名。
bluetooth found
選左個device就可以繼續,同埋輸入個 Passkey, E塊 Arduino BlueTooth 板用"1234"
Bluetooth Passkey
如果個Passkey正確就會繼續係部PC到加兩個聯絡端口。今次係com port 14,15。
Bluetooth com port
完成後,個Bluetooth UI就會係Devices度多左個device,同埋係個COM ports度多左兩個port。
其中com port 14係用作由PC輪出端口,com port 15係用作由PC接收端口。
bluetooth added device,bluetooth added COM port
咁就完成左安裝不過就未用得住, 同時Arduino bluetooth 上既Led會閃動。
要用個 Arduino bluetooth 就要先open個port去確認連線, 同時 Arduino bluetooth 上既Led會長著。
https://h2.hkepc.com/forum/attachment.php?aid=949045&k=a98932ec355458cfa49a85cd40f29815&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=949046&k=b5fb02ef13eb6269439f1f47e34ae20c&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=949047&k=b48355fdb937af4491afb3db30d79ed9&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=949048&k=e878f2d753c24c03e421ca620071ca19&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=949049&k=0c6342ab3fb6f84628995dc0eed39dbb&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=949050&k=49191694501e0591eeaaa61a77728185&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=949051&k=066f42a6f7749238103eb30287bb9031&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=949052&k=45c1f374acb9181bd9dda102ad8ca966&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=949053&k=e4a5e8c872c7f435d7f1a4e5457d6471&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=949054&k=da1b9790fdc59524feed00cee034cf79&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=949055&k=a9b5ee8d4a23ae319f24e16d77490214&t=1781441225&sid=13lm4A3qwEr

作者: zonebaby 時間: 2009-9-27 13:21
E個Code都係放在examples入面....
PC BlueTooth USB Dongle to Arduino BlueTooth with LCD Display Location
今次係試下傳送一個Text File,所以就用XP個Hyper terminal,可以係accessories/communication下搵到。
所以就要用根據加左用作輸出的com port 14。
PC_com port
可以用同 Arduino bluetooth 唔同既傳輸speed。
PC_com port speed
如果聯絡得上 Arduino bluetooth 上既Led就會長著。
見到Led長著就可以開始傳輸。
Hyper terminal sent file
用完就以disconnect
Hyperterminal disconnect
有需要用就再call個 Arduino bluetooth
Hyperterminal connect
個 Arduino 收到個text file,就會將內容輸出到 LCD Display
PC BlueTooth USB Dongle to Arduino BlueTooth Success
PC BlueTooth USB Dongle to Arduino BlueTooth 試機成功....
ps 加番D圖
[ 本帖最後由 zonebaby 於 2009-9-27 13:24 編輯 ]
https://h2.hkepc.com/forum/attachment.php?aid=949056&k=c08ec428a4a88d7afe8aca85cf7bc191&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=949057&k=ffea33b5766e87e9c9665f41fc878254&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=949058&k=0102fbed4d3aec7d3446e4b0a6ff8e65&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=949059&k=4faafbb0f6a489680a064d81c2ccd5eb&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=949060&k=7775a7ec16454f7746da42e876a73c47&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=949061&k=079ed711b212a0baf02a4fc06d315150&t=1781441225&sid=13lm4A3qwEr

作者: zonebaby 時間: 2009-9-27 13:22
後記:
又試下用個 LCD Smartie 由 BlueTooth 發資料。
測試時,有信號錯既問題,幾個speed既設定,試左一輪,至可以正常,遲D至搵下真正原因。
最後將個舊既 LCD Smartie code改左個速度去115200就用得。
但個 LCD Smartie 既速度最高只可以上到19200, 再高就再唔可以聯絡到個 Arduino BlueTooth
LCD Smartie Setup
LCD Smartie
個code係
- /*
- LCD Smartie testing
- */
- // include the library code:
- #include <LiquidCrystal.h>
- // initialize the library with the numbers of the interface pins
- LiquidCrystal lcd(13, 11, 7, 6, 5, 4);
- byte getByte;
- byte temmBbyte[8];
- void setup() {
- pinMode(3, OUTPUT);
- Serial.begin(115200);
- // set up the LCD's number of rows and columns:
- lcd.begin(20,4);
- lcd.clear();
- digitalWrite(3, HIGH);
- }
- byte getSerialByte() {
- int inSerialByte=0;
- while (Serial.available()==0){}
- inSerialByte=Serial.read();
- return (byte) (inSerialByte & 0xff);
- }
- void loop() {
- getByte=getSerialByte();
- if (getByte==254)
- {
- // test next command byte
- switch (getSerialByte())
- {
- case 66: //LCD backlight on
- digitalWrite(3, HIGH);
- break;
- case 70: //LCD backlight off
- digitalWrite(3,LOW);
- break;
- case 71: //LCD position [col] [row]
- temmBbyte[0]=(getSerialByte()-1);
- temmBbyte[1]=(getSerialByte()-1);
- lcd.setCursor(temmBbyte[0],temmBbyte[1]);
- break;
- case 72: //LCD home
- lcd.home();
- break;
- case 74: //LCD underline cursor on
- lcd.cursor();
- break;
- case 75: //LCD underline cursor off
- lcd.noCursor();
- break;
- case 78: //LCD custom character [no of custom char] [8 bytes char pattern])
- getByte=getSerialByte();
- for (int i=0; i<=7; i++)
- {
- temmBbyte[i]=getSerialByte();
- }
- lcd.createChar(getByte, temmBbyte);
- break;
- case 83: //LCD block cursor on
- lcd.blink();
- break;
- case 84: //LCD block cursor off
- lcd.noBlink();
- break;
- case 88: //LCD display clear
- lcd.clear();
- break;
- case 152: //LCD backlight brightness [brightness]
- analogWrite(3, getSerialByte()) ;
- break;
- }
- return;
- }
- lcd.print(getByte);
- }
Arduino BlueTooth LCD Smartie from PC BlueTooth USB Dongle 試機成功....
[ 本帖最後由 zonebaby 於 2009-10-1 02:07 編輯 ]
https://h2.hkepc.com/forum/attachment.php?aid=950687&k=a1c1c253c97c0fbc591c60bd3626bd4d&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=950688&k=8b16ee3f25031c900f425749e999bb2f&t=1781441225&sid=13lm4A3qwEr

https://h2.hkepc.com/forum/attachment.php?aid=950689&k=19763171eb3a8e89a5c859441dd747b2&t=1781441225&sid=13lm4A3qwEr

作者: 薯餅v.v 時間: 2009-9-27 16:40
試下配合lcd smartie 睇下得吾得
想知得吾得好耐不過冇錢買藍牙黎試
作者: zonebaby 時間: 2009-9-27 17:06
應該得,......計劃中.........
作者: 薯餅v.v 時間: 2009-9-27 17:11
期待
作者: zonebaby 時間: 2009-10-1 02:08
試左個舊code可以直接用,但要改下D速度。可意睇下post#5。
作者: michael2010 時間: 2009-12-12 11:22
另外一點想知道就係用十幾蚊買粒usb bluetooth dongle
拆左佢強行用MCU控制有冇機會行得通
不過唔知係咪一黎入面粒chip 係bulit-in usb interface,再轉就好慢
有空會試一試
作者: asp88 時間: 2010-1-3 00:27
等闲我都玩下
作者: pc1697 時間: 2010-9-25 22:47
Serial.Read() 同Serial.print() 係唔係一定行 PIN0/1 TX/RX??
作者: 秋本裕太 時間: 2010-10-27 22:48
我想問問要在Arduino上加上什麼
才可以接收PC bluetooth use dongle發出的訊號
還有有沒有更詳細的有關方面的資料可以提供
非常感謝樓主
作者: zonebaby 時間: 2010-10-28 08:25
睇下有冇用.....
http://www.hkepc.com/forum/redir ... 37&pid=21151069
作者: KwokAngus 時間: 2011-3-9 00:37
可唔可以用黎試玩遙控摩打
作者: prof2034 時間: 2012-6-28 09:27
之前試來試去都無data到bt,昨日試下把bt的接電重置.就正確連到,bt上的led會常亮.原因不明.有d似我地用藍牙耳機,有時要重開才可連接.
作者: 魚蛋Strike 時間: 2016-8-5 23:34
咁.... 用手機send BT呢?
又...用手機send BT, 去 Arduino 出rs232 command 要點玩呢?
作者: rmhc 時間: 2019-1-21 15:57
提示: 作者被禁止或刪除 內容自動屏蔽


