A seemingly simple bluetooth project made impossible through ineptitude. Help?

Hi!

I’m working on making a remote that will eventually, by the grace of some higher being, communicate via bluetooth with a central processing computer.
The information I’m trying to send is not that complicated: Two analog values from a joystick, and two button states.

So, the first thing I’m trying to do is to have the arduino (an arduino pro mini) read the analog value of the joystick and relay that information to my serial monitor via the bluetooth module (a smirf gold).

Should be simple, right?
Well, a cakewalk it is not.

I’ve stitched together two bits of code, because what do I know? A works, and B works, so let’s just put em together, right?

When sans bluetooth and connected via USB, I get the info printed on the monitor that I need. However, when connected via the tooth, the monitor simply vomits a string of garbage.

Any insights or direction pointing would be greatly appreciated!!

Below is the code I’m currently using. Please pardon the mess:

#include <SoftwareSerial.h>  

int bluetoothTx = 1;  // TX-O pin of bluetooth mate
int bluetoothRx = 0;  // RX-I pin of bluetooth mate
const int VERT = A6; // analog
const int HORIZ = A7; // analog
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup()
{
  Serial.begin(9600);  // Begin the serial monitor at 9600bps

  bluetooth.begin(115200);  // The Bluetooth Mate defaults to 115200bps
  bluetooth.print("$");  // Print three times individually
  bluetooth.print("$");
  bluetooth.print("$");  // Enter command mode
  delay(100);  // Short delay, wait for the Mate to send back CMD
  bluetooth.println("U,9600,N");  // Temporarily Change the baudrate to 9600, no parity
  // 115200 can be too fast at times for NewSoftSerial to relay the data reliably
  bluetooth.begin(9600);  // Start bluetooth serial at 9600
}

void loop()
{
  if(bluetooth.available())  // If the bluetooth sent any characters
  {
    // Send any characters the bluetooth prints to the serial monitor
    Serial.print((char)bluetooth.read());  
  }
  if(Serial.available())  // If stuff was typed in the serial monitor
  {
    // Send any characters the Serial monitor prints to the bluetooth
    bluetooth.print((char)Serial.read());
  }
  
  // int vertical, horizontal ;
   char vertical, horizontal ;
  // read all values from the joystick
  
  vertical = analogRead(VERT); // will be 0-1023
  horizontal = analogRead(HORIZ); // will be 0-1023
  //select = digitalRead(SEL); // will be HIGH (1) if not pressed, and LOW (0) if pressed
  
  // print out the values
  
  Serial.print("vertical \t");
  
 Serial.println(vertical, DEC);
  //Serial.print(vertical,DEC);
  
  delay(300);
  
  Serial.print( "horizontal: \t ");
  

 // Serial.print(" ");
  Serial.println(horizontal,DEC);
  delay(300);
  
  
  
}

Pins 0 and 1 are used for the hardware serial. If using software serial for bluetooth, put it on different pins.

Gibberish characters on serial often indicate baud rate mismatch.

It did seem to be the BAUD rate. I went into the settings of the module with the "D" command, and sure enough the default rate was 19200, not 115200 as I'd assumed.

Thank you for your speedy advice!

Next step: Perpetual Motion.