Go Down

Topic: Arduino Uno + Bluetooth Mate - Can't transmit from Bluetooth (Read 594 times) previous topic - next topic

kfc469

All,

I have an Arduino Uno and a Bluetooth module hooked together like this: http://www.wateb.com/arduino-uno-bluetooth-mate-gold/

I am able to pair the bluetooth module with my Mac with no issues. I loaded this code on the arduino:

Code: [Select]
#include <SoftwareSerial.h>

int bluetoothTx = 2;
int bluetoothRx = 3;

SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup()
{
  //Setup usb serial connection to computer
  Serial.begin(9600);

  //Setup Bluetooth serial connection to android
  bluetooth.begin(115200);
  bluetooth.print("$$$");
  delay(100);
  bluetooth.println("U,9600,N");
  bluetooth.begin(9600);
}

void loop()
{
  //Read from bluetooth and write to usb serial
  if(bluetooth.available())
  {
    char toSend = (char)bluetooth.read();
    Serial.print(toSend);
  }

  //Read from usb serial to bluetooth
  if(Serial.available())
  {
    char toSend = (char)Serial.read();
    bluetooth.print(toSend);
  }
}


When using this code, I am able to type strings in on the serial console and they are transmitted to the bluetooth console. However, when I type strings in to the bluetooth console, they are NOT transmitted to the serial console.

I am using CoolTerm for Mac. I've also tried Putty on the PC with no luck. My bluetooth connection settings are:
Baudrate:115200
Data bits: 8
Parity: none
Stop bits: 1
Flow control: off
DTR: on
RTS: on

Again, I am able to transmit from serial -> bluetooth with no issues, but bluetooth->serial is not working at all :(

Does anyone have any advice on how to fix this? I'm quite new to Arduino, but definitely not a novice in programming.

Thanks!
Kevin

tobyb121

As a quick check you can connect the rx and tx pins on the Bluetooth mate together, connect it in cool term and send a few characters. That will just confirm that it is sending and receiving properly. Apart from that, I can't see anything obviously wrong with your code

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy