Note that there are some explanatory texts on larger screens.

plurals
  1. POBluetooth communication between Arduino and PyBluez
    primarykey
    data
    text
    <p>I am trying to establish bluetooth communication between an Arduino Uno board (with a bluetooth shield) and my Linux OS, using Python PyBluez.</p> <p>I've successfully paired my laptop to the Uno. I'm able to connect to the board, however the board is not reading the data being sent nor is it able to send data.</p> <p>Here is the Arduino Sketch</p> <pre><code>#include &lt;SoftwareSerial.h&gt; #define RxD 0 //receive data on digital 0 #define TxD 1 //transmit on digital 1 SoftwareSerial blueToothSerial(RxD, TxD); int counter = 0; int incoming; void setup(void){ Serial.begin(9600); //pinMode(RxD,INPUT); //pinMode(TxD,OUTPUT); setupBlueToothConnection(); } void setupBlueToothConnection(){ blueToothSerial.begin(19200); blueToothSerial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as "SeeedBTSlave" blueToothSerial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me //blueToothSerial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here delay(2000); // This delay is required. blueToothSerial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable Serial.println("The slave bluetooth is inquirable!"); delay(2000); // This delay is required. blueToothSerial.flush(); } void loop(){ if(blueToothSerial.available()) Serial.println(blueToothSerial.read()); blueToothSerial.write('x'); } </code></pre> <p>And my Python Module:</p> <pre><code>import bluetooth import sys bd_addr = "00:12:10:23:10:18" #itade address port = 1 sock=bluetooth.BluetoothSocket( bluetooth.RFCOMM ) sock.connect((bd_addr, port)) print 'Connected' sock.settimeout(1.0) sock.send("x") print 'Sent data' data = sock.recv(1) print 'received [%s]'%data sock.close() </code></pre> <p>I have Arduino IDE 1.0.4, my laptop is running Ubuntu 11.10</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload