Buetooth Module + Arduino Leonardo Problem

Good day everyone! :slight_smile: A newbie here. i have a problem with my Arduino Leonardo and JY-MCU Bluetooth Module

I can't receive data / info from BlueTerm or Android App Using My Cellphone - Samsung Galaxy s4

i connect Rt and Tx good ... 0 - 1 port... // I've also tried to connect Tx and Rx to 2 - 3 pins And nothing happend //

Change the speed (9600 / 57600) and nothing...

Try.. Serial... Serial1 <SoftwareSerial.h> and nothing...

The only progress is that now i Can send info From a Humidity sensor way BlueTerm

look the code:

const int ledPin = 13; //LED conectado al pin13
void setup()
{
 Serial.begin(9600); //Inicializamos la consola serie
 pinMode(ledPin, OUTPUT);  // declaro el pin13 como salida
}

void loop()
{
 int a = analogRead(A0); // Tomo la lectura del pin A0 ( este no se declara pq automaticamente Lo hace Arduino)

 /*El arduino leonardo, y la mayoria de arduinos (sino todos), disponen de otro puerto serie por el que podemos
 emitir mas información. En este caso, enviaremos la temperatura a ese puerto serie extra, al cual estara conectado
 el emisor BT y que la emitirá al mundo*/

 Serial1.begin(9600);   
  Serial1.println(a); //enviamos la cadena por el puerto serie 1, que es el conectado al emisor/receptor BT.
  Serial1.end();     
  delay(1000); 
}

Hoping for your help! Thank you! XD

Several things

Please look at examples of how to use serial

Only call serial begin in setup

Don't call serial end. I didn't even know that serial end existed :wink:

Leonardo doesn't need to use software serial as hardware serial is on Serial1 because the link to the PC is direct via USB as part of the microprocessor .

You need to call the serial available function in your loop to check if data is available

Look in the examples that some with the IDE there is an example called something like multiple serial, its an example for the mega2560 but works on the leonardo

See how to read data correctly on serial1

Thaaaaaaaaanks so much bro !!! Finally i can send and receive data between Arduino and Android !! i can fixed whit MultiSerialMega !! :slight_smile: :slight_smile: :slight_smile: :slight_smile: :slight_smile:

Thanks You !!

that is a great idea man. any how thanks for sharing it