Where to advertise my android bluetooth interface software?

With BTInterface your main loop would be listening out for the string 'btinterface' this is to detect when it is connected.
Then when it heard it you would have a routine to change to screen1 where you could configure the controls.
You would hide all the controls that you don't need and change the labels on the buttons etc. and if necessary write some text in the labels that align with the main 4 buttons.

This configuring of screen1 might initially be in a function and then you might have several functions to configure screen1 in different ways.

Pressing any of the buttons will always send that buttons value and this can't be changed so pressing the b1 button will send the string 'b1' over the serial connection.
You would be responsible for knowing where you are in your code and what that b1 means at that point.

Here is a simple bit of pseudo code to illustrate where the character ' designates comments:

void loop(){
if(command == "btinterface"){
  config1() 'if I see the string btinterface then I know that we have a connection, either for the first time or after a disconnect so I'll call the function config1() to configure screen1:
 intMode = 1 'set variable so that I know I'm in 'config1' mode
} 'end of if statement

if(command == "b1") { 'then I know that b1 has been pressed
if(intMode == 1) { 'then I know that b1 has been pressed while I'm in Mode1 so I'll do a mode1 button1 press thing
send("say Ooh. I see you are in mode one and that the button which currently reads as. Action One!. has been pressed.")
send("sms 0123456789 this is a text message from your microcontroller just to let you know that I am currently in Mode 1 and the button Action One! has been pressed.")
'do other Mode1 Action One! things here.
'perhaps Action One! needs the screen1 to be reconfigured into mode 2? if so then:
config2()
intMode == 2
}

} 'end of loop

void config1(){
send("screen1") 'this causes BTInterface to change to screen1, also if BTInterface was sitting in the background this will cause screen1 to appear, it is only while screen1 is displayed that you can configure its controls.
send("pad hide")
send("sb hide")
send("b1 Action One!") 'this changes the text on button1 (b1) to read Action One!
send("b2 Action Two!")
send("b3 Action Three!")
send("b4 Action Four!")
'there, I have finished configuring screen1 into 'config1' mode. 
} 'end of config1() function.

Here is the actual sketch from my 'A little Scary' video ... please forgive the prehistoric programming techniques :slight_smile: I've never done C/C++ before.

#include <SoftwareSerial.h>
#include <Servo.h>
#include <stdlib.h>

Servo myservo;
SoftwareSerial softSerial(10, 11); // RX, TX
String command = ""; 
int r1 = 0;
int RelayPin = 2;
int val;
int pr1 = 3;
int pr2 = 4;
int pb1 = 5;
int pb2 = 6;


void setup()  
{
  Serial.begin(9600); //Remember to set the Arduino Serial Monitor to 9600 Baud and no line ending if you want to get AT commands to work before you connect. 
  softSerial.begin(9600); // SoftwareSerial "com port" data rate. JY-MCU v1.03 defaults to 9600.
  softSerial.println("Arduino Ready!"); 
  pinMode(2, OUTPUT);
  pinMode(pr1, INPUT_PULLUP);
  pinMode(pr2, INPUT_PULLUP);
  pinMode(pb1, INPUT_PULLUP);
  pinMode(pb2, INPUT_PULLUP);
  
  digitalWrite(RelayPin, LOW); 
  myservo.attach(9);
  }
  
void screen1set(){
 send("screen1");
 delay(300);
  
}
  
void loop()
{  
  if (Serial.available()) softSerial.write(Serial.read());
  while(softSerial.available() > 0) { // While there is more to be read, keep reading.
    command += (char)softSerial.read();
    delay(10);  
}

  if(command != "") Serial.println(command);
  
  if(command == "btinterface") screen1set(); //
  
  if(digitalRead(pr1) == LOW){
    send("say you pressed, red? 1.");
    delay(3000);
    send("say stand by. I shall initiate the turning on and off of relay 1.");
    delay(5000);
    send("say in. 5. 4. 3. 2. 1. ");
    delay(6000);
    command = "b1";
  }
  
  if(digitalRead(pr2) == LOW){
    send("say self destruct sequence aborted. phew!");
    delay(500);    
  }
  
  if(digitalRead(pb1) == LOW){
    send("say no? that was a blackwon. stupid?");
    delay(500);
  }
  
  if(digitalRead(pb2) == LOW){
    send("say self destruct sequence has been initiated. this system will self destruct in 30 seconds. press any red button to abort self destruct.");
    delay(500);
  }
  
  if(command.startsWith("sb")){ // Then the slidebar has been moved so alter the position of the servo!
    val = stringToNumber(command.substring(2));
    val = map(val, 100, 0, 0, 179);
    myservo.write(val);
    send("l4 " + command.substring(2));
  }
    
  if(command == "b2") {
   send("sms 07951123456 This apparatus will self destruct in 10 seconds!"); 
   digitalWrite(RelayPin, HIGH); 
 }
  
  if(command == "b1"){
    if(r1 == 0){
      r1 = 1;
      send("b1 Relay Off");  
      digitalWrite(RelayPin, HIGH);
      delay(500);
      return;
    }
    if(r1 == 1){
      r1 = 0;
      send("b1 Relay On");  
      digitalWrite(RelayPin, LOW);
      delay(500);
      return;
    }    
  }
    
  
  if(command == "b3") send("say Hello Ian. Remember to get to work on be tee interface?");
  
  command = ""; 
                                   
}// End Loop

int stringToNumber(String thisString) {
  int i, value = 0, length;
  length = thisString.length();
  for(i=0; i<length; i++) {
    value = (10*value) + thisString.charAt(i)-(int) '0';
  }
  return value;
}

void send(String s){
  softSerial.println(s);
}