You are reading a single comment by @JumJum and its replies. Click here to read the full conversation.
  • Now that Bluetooth.print works fine, next step is to test Bluetooth as console.
    First step is to write a simple function, which

    1. set a timeout
    2. in this, timeout set bluetooth to console
      2.1. set one more timeout
    3. in this timeout set Console back to Serial1
      Some prints are added to each step.

    Expectation for this function is,

    • after 1 sec console is switched to Bluetooth, which happens
    • 5secs later console is switched back to Serial1, which never happens

    Hopefully the following description is not too confusing

    function testConsole(){
      setTimeout(function(){
        Bluetooth.setConsole(true);
        setTimeout(function()  {
          //Bluetooth.print("BT \n");     Serial1.print("Ser BT \n");
          Serial1.setConsole(true);
          //Bluetooth.print("SER set\n"); Serial1.print("Ser SER set\n");
        },5000);
        //Bluetooth.print("BT set\n");    Serial1.print("Ser BT set\n");
      },1000);
    }
    

    Testing itself is

    • upload the function
    • start uart service in WebIDE
    • connect from my android to uart service with nRF UART v2.0
    • call the function TestConsole in WebIDE

    On WebIDE I see

    testConsole() // start of function(see function above)**
    =undefined
    -> Bluetooth // Message from firmware
    Ser BT set // Bluetooth is set to console
    Ser BT // before setting Serial to be console

                                   // message missing from firmware, that Serial1 is switched back from BT
                                  // message missing from 2nd setTimeout, that serial is set to console
    

    In nRF Uart everything looks like expected

    RX: <- Serial1 //message from firmware, console switched from Serial1 to BT
    BT set // Bluetooth is set to Console
    BT // before switching back to Serial

    [J->Serial1 // message from firmware, console switched to Serial
    RX: Ser set // message from 2nd setTimeout, console is switched back to Serial1

About

Avatar for JumJum @JumJum started