Wireless Bluetooth RS232 TTL Transceiver Module: Difference between revisions

From air
Jump to navigation Jump to search
Line 78: Line 78:


* [[Amarino]]
* [[Amarino]]

If you have Amarino installed on your Android phone, this code on the arduino is enough to read the values from the integrated compass.


///////////// CODE ///////////////////
/*
Receives compass sensor events from your phone.
*/
#include <MeetAndroid.h>

// MeetAndroid meetAndroid();
// you can define your own error function to catch messages
// where not fuction has been attached for
MeetAndroid meetAndroid(error);

void error(uint8_t flag, uint8_t values){
Serial.print("ERROR: ");
Serial.print(flag);
}

void setup()
{
// use the baud rate your bluetooth module is configured to
// Bluetooth module native is 9600
// not all baud rates are working well, i.e. ATMEGA168 works best with 57600
Serial.begin(9600);
// register callback functions, which will be called when an associated event occurs.
// - the first parameter is the name of your function (see below)
// - match the second parameter ('A', 'B', 'a', etc...) with the flag on your Android application
meetAndroid.registerFunction(compass, 'A');

}

void loop()
{
meetAndroid.receive(); // you need to keep this in your loop() to receive events
}

/*
* This method is called constantly.
* Compass events are sent several times a second.
*
* note: flag is in this case 'A' and numOfValues is 1
* since compass event sends exactly one single int value for heading
*/
void compass(byte flag, byte numOfValues)
{
// we use getInt(), since we know only data between 0 and 360 will be sent
int heading = meetAndroid.getInt();
Serial.println(heading);
}

///////////////// CODE ///////////////////////

Revision as of 11:02, 9 December 2011

http://www.dealextreme.com/p/wireless-bluetooth-rs232-ttl-transceiver-module-80711

Characterisques

Bluetooth module SKU 80711
Bluetooth module SKU 80711 + Arduino
  • Wireless Bluetooth RS232 TTL transceiver module
  • Allows your target device to both send and receive the TTL data via Bluetooth technology without connecting a serial cable to your computer
  • Easy to use and completely encapsulated
  • Chipset: CSR BC417143 http://www.csr.com/products/technology/bluetooth
  • Bluetooth V2.0
  • Working voltage: 3.3V
  • Current: pairing 20~30mA, connected 8mA
  • User defined Baud rate: 1200, 2400, 4800, 9600, 19200, 38400, 57600, and 115200
  • Default serial port setting: 9600, N, 8, 1
  • Password: 1234
  • Suitable for: mouse, keyboard, joystick; computers and peripherals; GPS receiver; instrument and industrial control

Dimensions: 1.06 in x 0.51 in x 0.04 in (2.7 cm x 1.3 cm x 0.1 cm) Weight: 0.18 oz (5 g)

Links

Connections

(pad with golden dot next to it is pin 1):

  • 1: TX (data out)
  • 2: RX (data in)
  • 11: RESET (connect to ground to reset, pullup-resistor of 10K recommended)
  • 12: VCC (3.3V)
  • 13: GND
  • 24: LED output (ON when there is a connection, BLINKS when there isn't).
  • 26: KEY ????


D'après http://www.cutedigi.com/pub/Bluetooth/BMX_Bluetooth_quanxin.pdf copie locale


  • 1 : UART-TX
  • 2 : UART-RX
  • 3 : UART-CTS
  • 4 : UART-RTS
  • 5 : PCM-CLK
  • 6 : PCM-OUT
  • 7 : PCM-IN
  • 8 : PCM-SYNC
  • 9 : AIO(0)
  • 10: AIO(1)
  • 11: RESET (connect to ground to reset, pullup-resistor of 10K recommended)
  • 12: VCC (3.3V)
  • 13: GND
  • 14: GND
  • 15: USB D-
  • 16: SPI-CSB
  • 17: SPI-MOSI
  • 18: SPI-MISO
  • 19: SPI-CLK
  • 20: USB D+
  • 21: GND
  • 22: GND
  • 23: PIO(0)
  • 34: PIO(11)

Remarque

  • le fil à wrapper est parfait pour réaliser les sondures !
  • ne pas inverser (comme moi) GND et 3.3V : le module est mort sinon !

Applications

If you have Amarino installed on your Android phone, this code on the arduino is enough to read the values from the integrated compass.


///////////// CODE /////////////////// /*

 Receives compass sensor events from your phone.
 
  • /
  1. include <MeetAndroid.h>

// MeetAndroid meetAndroid(); // you can define your own error function to catch messages // where not fuction has been attached for MeetAndroid meetAndroid(error);

void error(uint8_t flag, uint8_t values){

 Serial.print("ERROR: ");
 Serial.print(flag);

}

void setup() {

 // use the baud rate your bluetooth module is configured to 
 // Bluetooth module native is 9600
 // not all baud rates are working well, i.e. ATMEGA168 works best with 57600
 Serial.begin(9600); 
 
 // register callback functions, which will be called when an associated event occurs.
 // - the first parameter is the name of your function (see below)
 // - match the second parameter ('A', 'B', 'a', etc...) with the flag on your Android application
 meetAndroid.registerFunction(compass, 'A');  

}

void loop() {

 meetAndroid.receive(); // you need to keep this in your loop() to receive events

}

/*

* This method is called constantly.
* Compass events are sent several times a second.
*
* note: flag is in this case 'A' and numOfValues is 1 
* since compass event sends exactly one single int value for heading
*/

void compass(byte flag, byte numOfValues) {

 // we use getInt(), since we know only data between 0 and 360 will be sent
 int heading = meetAndroid.getInt(); 
 Serial.println(heading);

}

///////////////// CODE ///////////////////////