*Arduino とBluetooth mateを接続する(Mac OS X編) [#h725d75d] #author("2022-01-13T19:14:49+09:00","","") http://skpang.co.uk/catalog/images/wireless/2-4ghz/09358-01.jpg 簡単に接続できるBluetoothモジュールをArduinoにつないでみる。 **Bluetooth mateをMac OS Xとペアリングする [#u3f00030] {前回のあらまし} [[けこたんぶろぐ:http://miracle-kktn.blogspot.jp/2014/02/bluetooth-mate-gold.html]] を見てください。 ここで、接続で$$$などと送ってセットアップモードに入って、---を送ってセットアップモードから抜けられることを確認してください。 **Arduino --> Bluetooth mate --> Macintoshとデータを送ってみる [#j87d2b38] このモジュールは0,1番ピンにつながっているので、それぞれをRx,TxにするようSoftware Serialを利用します。 以下で、Arduinoから文字列をMacintoshに送ることができます。 #include <SoftwareSerial.h> SoftwareSerial mySerial(0, 1); void setup() { mySerial.begin(57600); } void loop() { mySerial.println("hello"); delay(1000); } 逆に、 mySerial.read(); などすればMacintoshからデータを受け取れます。 ***Mac OS XからC, Python, Javaでシリアル経由でデータ送受信する [#ua0ec6e5] [[ここにまとめてあります:http://is.ocha.ac.jp/~gradthesis/index.php?cmd=read&page=How2SerialOSX]]ので、見てください。