Robofun 機器人論壇

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

藍芽與arduino通訊問題

[複製鏈接]
1#
發表於 2012-8-9 11:18:48 | 顯示全部樓層
回復  vegewell

很謝謝你,但我身邊朋友其實沒有甚麼人在玩arduino所以也沒有板子可以借

問題其實就像 ...
k29645806 發表於 2011-12-8 02:42



    我的情況跟你一樣,沒有其他人借來試。  花了三天才看到這文章。
如果用 softserial, 可否改用其他 pin 來收訊息?
http://arduino.cc/hu/Reference/SoftwareSerial

Example
  /*
  Software serial multple serial test

Receives from the hardware serial, sends to software serial.
Receives from software serial, sends to hardware serial.

The circuit:
* RX is digital pin 10 (connect to TX of other device)
* TX is digital pin 11 (connect to RX of other device)

Note:
Not all pins on the Mega and Mega 2560 support change interrupts,
so only the following can be used for RX:
10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69

Not all pins on the Leonardo support change interrupts,
so only the following can be used for RX:
8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

created back in the mists of time
modified 25 May 2012
by Tom Igoe
based on Mikal Hart's example

This example code is in the public domain.

*/
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup()  
{
  // Open serial communications and wait for port to open:
  Serial.begin(57600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(4800);
  mySerial.println("Hello, world?");
}

void loop() // run over and over
{
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}
2#
發表於 2012-8-14 12:33:33 | 顯示全部樓層
成功!
再次改 BAUD RATE。 其實早前做過但不成功。
今次又得。
可參考 : http://coopermaa2nd.blogspot.hk/ ... to-ttl-adapter.html

code 及 schematic  : http://arduino.cc/playground/Learning/Tutorial01
您需要登錄後才可以回帖 登錄 | 申請會員

本版積分規則

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

GMT+8, 2024-5-17 07:35 , Processed in 0.138101 second(s), 7 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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