2012-05-05 74 views
5

ArduinoとMacをシリアル通信でBluetoothで接続しようとしていますが、問題があります。それはに示すよう sparkfunから Arduino UNOとMacとBluetooth通信でシリアル通信

  • のBluetoothメイト
  • のMacBook、OS X 10.7
  • まず、私は、以下のようなArduinoのをプログラムし

    • ArduinoのUNO:

      私の環境では、ということですthis tutorial

      /*********************** 
      Bluetooth test program 
      ***********************/ 
      
      int counter = 0; 
      int incomingByte; 
      
      void setup() { 
          Serial.begin(115200); 
      } 
      
      void loop() { 
          // see if there's incoming serial data: 
          if (Serial.available() > 0) { 
          // read the oldest byte in the serial buffer: 
          incomingByte = Serial.read(); 
          // if it's a capital R, reset the counter 
          if (incomingByte == 'R') { 
           Serial.println("RESET"); 
           counter=0; 
          } 
          } 
      
          Serial.println(counter); 
          counter++; 
      
          delay(250); 
      } 
      

      ArduinoがUSBで配線されていたとうまくいきました。 (Arduinoのコンソールは、1,2,3,4 ...のような数字の並びを改行で受信します)

      次に、Arduino UNOとBluetooth Mateをいくつかのワイヤで接続し、Macとペア設定しました。

      iTermでこの行を実行すると、疑問符のシーケンスしか受け取られませんでした。

      $ sudo cu -s 115200 -l /dev/tty.name-of-port 
      Connected. 
      ?????????????????????????????? 
      

      私はまたscreen /dev/tty.name-of-port、またはArduinoのコンソールを試みたが、結果はすべて同じです。

      どのようにこれらの歪んだ信号を解決し、正しい文字を受け取ることができますか? ありがとうございます。

    +0

    UNOとBluetoothメイトの接続方法について投稿できますか? – Sudar

    答えて

    0

    多分それは高いボーレートのためです。それを9600に減らしてみてください。シリアル接続には115200が多すぎると感じています。