I am trying to communicate Arduino from PC and vice versa through a Bluetooth module [ "Bluesmirf silver" from sparkfun]. I have successfully configured the Bluetooth module by connecting it to PC. I have changed its baud rate to 9600 in configuration mode. The objective of this experiment is to print the characters from serial port terminal application [ coolterm] to Arduino serial monitor and vice versa through Bluetooth.I have connected
VCC of bluesmirf to 5v in Arduino
GND to GND in Arduino
TX to pin2
RX to pin3
connection between PC and the module is successful and the character that I typed in Arduino serial monitor was printed in serial port terminal application window [ coolterm] but the problem is the character that I typed in cool term is not printed in serial monitor.
code:
#include <SoftwareSerial.h>
int bluetoothTx = 2;
int bluetoothRx = 3;
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);
void setup()
{
Serial.begin(9600);
bluetooth.begin(9600);
}
void loop()
{
if(bluetooth.available())
{
Serial.print((char)bluetooth.read());
}
if(Serial.available())
{
bluetooth.print((char)Serial.read());
}
}
Anyone knows how to fix this?