Kit Robotica - Bluetooth module code




  • Hello,
    some days ago i posted a video about my project with bq Kit robotica.
    It was a Lego car controlled by Android.
    I was able to use every component of the Kit, except for the bluetooth module.
    I don't have the kit anymore as it was send to me for a review test in my magazine.

    So the question is how to put that to work? I guess is similar to other bluetooth modules.
    I was able to use one that i have, that is almost equal to bq. It has only 4 pins instead of 6, but
    the bq only use 4 of 6:
    TX/RX/5V/ground  
    That's what i did, put the pins in the right places, i got some experience with Arduinos, i now that i did the correct procedure.
    but it didn't work. My software in Android cannot send any info to it. It recognize the module with no problem, but
    it cannot send any byte to it.

    The code:
    in void setup i have:

    void setup()
    {                
      Serial.begin(9600);      // start the serial connection
    }

    And in the main code i have:
    char variable_bluetooth = Serial.read();   // gets 1 byte from Android

    With my module (that have the same specs as the bq one) it works with no problem.
    But the bq module refuses to work, it don't get any byte from Android.
    Notice that the connection is ok, Android and the module communicate with each other, and are paired.
    But just don't receive anything.
    Is there a different protocol to the bq module?

    I cannot test again, as i said i got the kit for a couple of days to make a review about it, and i don't have it anymore, but
    i may order one and i would like to now if i am able to fix this.

    Can anyone help me to confirm the code? Do you have a sample code?
    Thanks


  • Hola TiagoLoboDias, perdona que te conteste en castellano.

    Pasate por este blog  http://robotstyles.blogspot.com.es/ en concreto por la entrada http://robotstyles.blogspot.com.es/2014/02/probamos-el-bluetooth-i.html puede que te sirva de algo los ejemplos.

    (el blog tambien está en castellano)

    Un saludo



  • Thanks joselv, 

    The code looks a bit different from what i used: 
    It was a HC-05 that needs a caracter de nueva linea.
    My module is not like this and it does not need "new line"... so i guess this is the problem.

    Pero no todo iba a ser tan fácil, aun nos quedan algunas consideraciones. Si el módulo que estamos utilizando es un HC-05, después de cada comando AT debemos mandarle un caracter de nueva linea (NL) y retorno de carro (CR), o sea, en el monitor serial pondremos "Ambos NL & CR" en la casilla inferior. Pero si el módulo que tenemos es un HC-06 no hay que poner nada por lo que pondremos "No hay fin de linea".