Grove Base Shield + Module Bluetooth Grove + Arduino Mega 2560

Bonjour, je me présente , je suis un étudiant en terminal S SI , je recherche actuellement de l'aide pour mon projets de fin d'année comptant dans ma moyenne de bac .

Je suis actuellement à la recherche d'aide pour une liaison entre mon module Bluetooth et mon portable
Mon montage est constitué :

  • d'une Arduino Mega 2560 Rev3
  • d'un Module Grove Base Shield
  • Module Bluetooth Grove 113020008
  • d'une LED
  • et d'un Grove - Temperature&Humidity Sensor

Je vous met la photo du montage , plus bas !!!

J'ai réussi à programmer mon capteur de température et d'humidité pour qu'il m'affiche ces données recueillis sur un écran LCD ou sur le moniteur série . J'ai aussi réussi à contrôler ma LED grâce à mon moniteur série . Mais je suis actuellement bloquer pour régler et programmer mon module Bluetooth , soit pour allumer la LED grâce à mon téléphone , soit pour recueillir les données de mon capteur sur mon téléphone .

Ceci est le code pour initialiser mon module Bluetooth , il arrive à se connecter à mon portable dans ce cas là :

#include <SoftwareSerial.h>   //Software Serial Port
#define RxD 6
#define TxD 7

SoftwareSerial blueToothSerial(RxD,TxD);

void setup()
{
 Serial.begin(9600);
 pinMode(RxD, INPUT);
 pinMode(TxD, OUTPUT);
 setupBlueToothConnection();
}

void loop()
{
 char recvChar;
 while(1){
   if(blueToothSerial.available()){//check if there's any data sent from the remote bluetooth shield
     recvChar = blueToothSerial.read();
     Serial.print(recvChar);
   }
   if(Serial.available()){//check if there's any data sent from the local serial terminal, you can add the other applications here
     recvChar  = Serial.read();
     blueToothSerial.print(recvChar);
   }
 }
}

void setupBlueToothConnection()
{
 blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
 blueToothSerial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
 blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as "SeeedBTSlave"
 blueToothSerial.print("\r\n+STPIN=0000\r\n");//Set SLAVE pincode"0000"
 blueToothSerial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
 blueToothSerial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
 delay(2000); // This delay is required.
 blueToothSerial.print("\r\n+INQ=1\r\n"); //make the slave bluetooth inquirable
 Serial.println("The slave bluetooth is inquirable!");
 delay(2000); // This delay is required.
 blueToothSerial.flush();
}

Celui-ci me permet théoriquement de contrôler une LED à l'aide d'un moniteur série installer sur mon portable mais je n'arrive pas à le faire fonctionner :

#include <SoftwareSerial.h>   //Software Serial Port
#define RxD 6
#define TxD 7

SoftwareSerial blueToothSerial(RxD,TxD);

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);
 pinMode(RxD, INPUT);
 pinMode(TxD, OUTPUT);
 setupBlueToothConnection();
}

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 = "";
  }
}

void setupBlueToothConnection()
{
 blueToothSerial.begin(38400); //Set BluetoothBee BaudRate to default baud rate 38400
 blueToothSerial.print("\r\n+STWMOD=0\r\n"); //set the bluetooth work in slave mode
 blueToothSerial.print("\r\n+STNA=SeeedBTSlave\r\n"); //set the bluetooth name as "SeeedBTSlave"
 blueToothSerial.print("\r\n+STPIN=0000\r\n");//Set SLAVE pincode"0000"
 blueToothSerial.print("\r\n+STOAUT=1\r\n"); // Permit Paired device to connect me
 blueToothSerial.print("\r\n+STAUTO=0\r\n"); // Auto-connection should be forbidden here
 delay(2000); // This delay is required.
 blueToothSerial.flush();
}

Je souhait donc de l'aide pour le deuxième code pour pouvoir allumer une LED à distance et par la suite recréer un nouveau programme pour envoyer des informations sur mon téléphone

Merci de votre aide