Hardware Reference
In-Depth Information
Arduino #2: Bluetooth
module is communi-
cating with Arduino's
processor
Arduino #1: Bluetooth
module is communi-
cating with the PC
through the USB-to-
serial processor
MADE
IN I TALY
MADE
IN I TALY
DIGITAL (PWM ~ )
DIGITAL (PWM ~ )
- +
- +
L
L
UNO
UNO
TX
RX
ON
TX
RX
ON
ARDUINO
ARDUINO
RESET
ICSP
RESET
ICSP
POWER
ANALOG IN
POWER
ANALOG IN
Figure 6-20
The Arduino module on the left is used as a USB-to-Serial adapter for a Bluetooth Mate module. Notice
how RX is attached to RX and TX to TX. That's because the Bluetooth Mate is actually talking to the
PC through the USB-to-Serial adapter, not the Arduino's main processor, so the serial connections are
reversed. When you want the Bluetooth module to talk to the Arduino's main processor, you'll swap
these two connections, as shown at right.
Step 2: Getting to Know the
Commands
The Bluetooth Mate radios use a serial command set for
command and configuration, which has two modes—
command mode and data mode—just like the XBee radios.
When you first power up a Bluetooth Mate and connect
to its serial interface (using Arduino #1 in Figure 6-20, for
example), it's in data mode. To see that it's alive, type: $$$ .
It will respond:
Program Arduino #2 using a basic serial sketch, as follows:
void setup() {
Serial.begin(115200);
}
void loop() {
Serial.println("Hello Bluetooth!");
}
When you open a Bluetooth connection to this radio, you'll
see the following message over and over:
CMD\r
All of the radio's responses will be followed by a carriage
return, as shown here. All of your input commands should
be followed by a carriage return (press Enter or Return).
Hello Bluetooth!
Hello Bluetooth!
Hello Bluetooth!
 
Search WWH ::




Custom Search