NO envia texto a Arduino por bluetooth - Inventor app does not send text over bluetooth

Hola estimados, tengo un problema con app inventor. No envía el texto a arduino, se envía solo. aquí les dejo unas fotos de los programas de prueba que hice para verificar la llegada de datos, probé de muchas formas modificando el código arduino pero de ninguna manera lo recibe, sigue enviándose solo. Tengo un modulo bluetooth HC06 y un arduino mega.

Hello dear, I have a problem with app inventor. It doesn't send the text to arduino, it sends itself. Here are some photos of the test programs that I did to verify the arrival of data, I tried in many ways modifying the arduino code but it does not receive it in any way, it continues to send itself.I have a bluetooth module HC06 and an arduino mega.

ardu

Lo que pasa es que el bluetooth envia el valor Ascii del caracter que vos indicás. Por ejemplo para la letra A tenés que preguntar en Arduino si recibió un 65 ( Ascii de "A")

That depends on the Arduino Sketch code Pablo - what if the App sent a stream of words?

Hello Marcelo

I suggest that you walk before you run. At the moment, your App code is persistently receiving data when at the same time an arbitrary button click sends data - that's a recipe for trouble. So if you want to send data, first define a separate Project to work with so you can accomplish that goal.

Cannot offer more advice as we cannot see all your blocks nor all your Sketch/Script. It would help us to help you if we knew what the ultimate goal of your App is exactly.

Probe de muchas maneras de convertir el "lo q envia", el problema es que creo q no envia nada. Ya que ni en un simple codigo como este le llega algo al monitor serie, ni siquiera codigos, nada, queda vacio. pero si envia datos desde el arduino a la app.
bluu

Hello friend, I did not want to upload the main code where I have the problem because it is basically the same problem. In the project where I need data to arrive, it is longer and it is the same problem that I have here, the data that I send from the app does not reach arduino. But if they arrive from the arduino serial monitor to the application. Here's another test example I did and nothing comes out, no codes or anything.
bluu

Marcelo

You can't separate the Script and the App Block code and expect answers from us, the two code sources have to work together.

Unless you are a secret agent for your government or something, there should not be a reason why you can't upload all your information.

... and please answer our questions, they are designed to help us to help you!

Lol, I made this block for testing nothing else. Because as I explained, I have the same problem in another, therefore I decided to test if I receive data from the app with this block.
bluu

Looks like you do not need SoftwareSerial:
https://www.arduino.cc/en/pmwiki.php?n=Main/ArduinoBoardMega

Your HC06 is 3.3v, you need to divide the Arduino's 5V TX line down to 3.3v (2 resistors). If you have not done this already, the module may be fried.........

It's a while since I did this but you are disconnecting the tx, rx pins when you upload your sketch?

1 Like

Try this Test App:
BT_Basic_Setup_Send.aia (7.8 KB)

with this Sketch:
Send.txt (652 Bytes)

//vars
unsigned int igUpdateTime;
char val[];

void setup()
{
         Serial.begin(9600);
         Serial1.begin(9600);
         igUpdateTime = millis();
}

void loop()
{
         //Excute loop every 1/2 second
	     if(millis() - igUpdateTime > 500) 
         {
               igUpdateTime = millis();
               
               if (Serial.available() > 0)
               {
                    //Read Data From App
                    val = Serial.read();
               
                    //Send to Arduino Seria Monitor on PC (via USB cable)
                    Serial1.println(val)
               }
         }
}
1 Like

arduino_BT.aia (2.5 KB)

#include <SoftwareSerial.h>
SoftwareSerial miBT(10,11);
// El TX del módulo BT va al pin 10 del Arduino
// El RX del módulo BT va al pin 11 del Arduino
char D;

void setup() {
  Serial.begin(9600);
  miBT.begin(9600);
}

void loop() {
  if(Serial.available()>0){
    D = Serial.read();
    miBT.print(D);
  }
  if(miBT.available()>0){
    D = miBT.read();
    if(D == 'A'){
      Serial.print("hola");
    }
    delay(300);
  }
}
1 Like

Muchas gracias a todooos..!
El problema principal era que arduino mega no necesita la libreria software serial, y yo insistia en agregarla en cada prueba. :man_facepalming: :man_facepalming: :man_facepalming:
Thank you very much to all..!
The main problem was that the arduino mega doesn't need the serial software library, and I insisted on adding it in every test. :man_facepalming: :man_facepalming: :man_facepalming:

That's good, I know it can be a long slow process. I wish I could go to a club and talk face to face with people more experienced than me, not hard, and they would see the mistakes/errors straight away. Trying to learn on your own is hard going!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.