HC-05 Connection Problems

I think this forum hates me but I have to try... (P.S. I am a fellow nerd and I love you guys btw)

As an Arduino noob, I have somehow created an LED Coffee table which powers on, the Arduino sketch runs as expected displaying the menu options and everything with the configuration of the table seems to be in order. The one issue I am now having is that I cannot control the table using the bluetooth controller (my smartphone). At first, I thought it was a problem with the HC-05 unit not sending serial data to the Arduino but I used this code to test it I found after hours of research. Basically, the simple code turns the LED at pin 13 on when an "a" command is entered via the Bluetooth terminal android app, and turns the LED off with a "b" command.

/*
Arduino Turn LED On/Off using Serial Commands
Created April 22, 2015
Hammad Tariq, Incubator (Pakistan)

It's a simple sketch which waits for a character on serial
and in case of a desirable character, it turns an LED on/off.

Possible string values:
a (to turn the LED on)
b (tor turn the LED off)
*/

char junk;
String inputString="";

void setup()                    // run once, when the sketch starts
{
 Serial.begin(9600);            // set the baud rate to 9600, same should be of your Serial Monitor
 pinMode(13, OUTPUT);
}

void loop()
{
  if(Serial.available()){
  while(Serial.available())
    {
      char inChar = (char)Serial.read(); //read the input
      inputString += inChar;        //make a string of the characters coming on serial
    }
    Serial.println(inputString);
    while (Serial.available() > 0)  
    { junk = Serial.read() ; }      // clear the serial buffer
    if(inputString == "a"){         //in case of 'a' turn the LED on
      digitalWrite(13, HIGH);  
    }else if(inputString == "b"){   //incase of 'b' turn the LED off
      digitalWrite(13, LOW);
    }
    inputString = "";
  }
}

To my surprise, this code works and my smartphone is able to toggle the LED at pin 13 on and off with these commands. So the HC-05 is getting some form of serial data so it can't be that the HC-05 is burned out or not communicating with the Arduino - now I figured its time to start looking into the LED table code for a problem. Unfortunately, I'm learning about Arduino coding as I go and I'm not sure what the problem could be. Here is the main LED Table code being used, which contains the bluetooth controller info:

/* LedTable
 *
 * Written by: Klaas De Craemer, Ing. David Hrbaty
 * 
 * 
 * Main file with common methods and defines, such as button reading from Bluetooth controller
 * or setting pixels on the LED area
 */
#include <SoftwareSerial.h>
//LED field size
#define  FIELD_WIDTH       14
#define  FIELD_HEIGHT      14
#define  ORIENTATION_HORIZONTAL //Rotation of table, uncomment to rotate field 90 degrees

#define USE_FAST_LED   // FAST_LED as library to control the LED strips


#define BLUETOOTH_SPEED 38400 
/*
 * Some defines used by the FAST_LED library
 */
#define FAST_LED_CHIPSET WS2811
#define FAST_LED_DATA_PIN  6


#if defined(USE_OCTOWS2811) && defined(USE_FAST_LED)
#error "Only one of USE_OCTOWS2811 and USE_FAST_LED can be defined"
#endif

#define  NUM_PIXELS    FIELD_WIDTH*FIELD_HEIGHT

/* *** LED color table *** */
#define  GREEN  0x00FF00
#define  RED    0xFF00FF
#define  BLUE   0x0000FF
#define  YELLOW 0xFFFF00
#define  LBLUE  0x00FFFF
#define  PURPLE 0xFF00FF
#define  WHITE  0XFFFFFF
unsigned int colorLib[3] = {YELLOW, BLUE, WHITE};
/* *** Game commonly used defines ** */
#define  DIR_UP    1
#define  DIR_DOWN  2
#define  DIR_LEFT  3
#define  DIR_RIGHT 4

/* *** Bluetooth controller button defines and input method *** */
#define  BTN_NONE  0
#define  BTN_UP    1
#define  BTN_DOWN  2
#define  BTN_LEFT  3
#define  BTN_RIGHT  4
#define  BTN_START  5
#define  BTN_EXIT  6

uint8_t curControl = BTN_NONE;
SoftwareSerial bluetooth(11, 10);

void readInput(){
  curControl = BTN_NONE;
  if (bluetooth.available() > 0) {
    // read the incoming byte:
    uint8_t incomingByte = bluetooth.read();
    Serial.println(incomingByte);
      switch(incomingByte){
        case 238:
          curControl = BTN_LEFT;
          break;
        case 239:
          curControl = BTN_RIGHT;
          break;
        case 236:
          curControl = BTN_UP;
          break;
        case 237:
          curControl = BTN_DOWN;
          break;
        case 224:
          curControl = BTN_START;
          break;
        case 225:
          curControl = BTN_EXIT;
          break;
      }
    } 
}

I have tried multiple bluetooth apps, including the Arduino Bluetooth Controller and I cannot seem to get the table to respond to any commands. Does anyone have any idea what I can be doing wrong here..? If there is any further information i can provide, please let me know. This is literally the last phase of this project and i am breaking my brain trying to figure out what is happening here.

Thanks!

Also, I don't know if this helps anyone but when I enter commands via the smartphone to the HC-05, whatever I enter is then immediately parroted back to my phone from the HC-05. So for example:

I enter > A
HC-05 replies: A

puredark:
I enter > A
HC-05 replies: A

Bluetooth is clearly innocent then? You might put a new title on this thread that better describes the problem.

Nick_Pyner:
Bluetooth is clearly innocent then? You might put a new title on this thread that better describes the problem.

Hey Nick - I think I may have figured it out with information you actually posted in the forum back in 2014.

This article was really helpful as was this post.

I can't try it yet as I'm at work but maybe you can tell me if I'm on the right track? I am using an Arduino Mega which is connected to the RX & TX pins on the Mega (0,1 pins). The code for the table uses SoftwareSerial, and from what I'm reading the 0 & 1 pins are actually hardware serial (is this right?).

Therefore, in the code snippet below:

uint8_t curControl = BTN_NONE;
SoftwareSerial bluetooth(11, 10);

This means the SoftwareSerial library is looking for the 11 & 10 pin, not the 0,1 HARDWARE pins? So if I re-solder the connections from the 0,1 pins to the 11,10 pins, I'm guessing this should allow communication with SoftwareSerial, thus allowing the app to control the table. Any credence to this or am I dead wrong?

Thanks for your help!

puredark:
from what I'm reading the 0 & 1 pins are actually hardware serial (is this right?).

Correct. Note also that there are three more hardware serial ports on a Mega, on pins 14>19, so using software serial on a Mega is not something you should be telling your mother.

So if I re-solder the connections from the 0,1 pins to the 11,10 pins,

I don't think you should be re-soldering anything - unless, of course you have already done some, in which event it might be a good idea to put things back where they were. Perhaps you mean connections on a proto shield.

Nick_Pyner:
I don't think you should be re-soldering anything - unless, of course you have already done some, in which event it might be a good idea to put things back where they were. Perhaps you mean connections on a proto shield.

Yes sorry mis-spoke. It is connections on a Protoshield. Thanks for your help, past and present.

puredark:
Protoshield

OK. In that event, transferring to pins 18,19 and using Serial1 is a better way to go.

Nick_Pyner:
OK. In that event, transferring to pins 18,19 and using Serial1 is a better way to go.

If I do this, the entire code would need to be re-written to accept the hardware serial instead of the SoftwareSerial though, correct?

Correct, and about the smartest move you will ever make - it's even one you can tell your mother about.
But "entire code" is a bit fast and loose. About all you need do is delete the include Software Serial, and bulk replace all the BTSerials with Serial1