1 Reply Latest reply on Feb 5, 2016 7:07 AM by Intel_Peter

    How to implement Yocto command in arduino? Bluez, Gatt

    channinglin

      Hi all,

       

      I am using a NRF8001 Bluetooth 4.0 module + PIR sensor to communicate with my Intel Edison. Following some instructions I found in this forum, one of the possible solution is to use GATT (https://software.intel.com/en-us/articles/using-the-generic-attribute-profile-gatt-in-bluetooth-low-energy-with-your-intel-edison).  First  I installed Gatttool as well as Bluez-5.24 software package in my Edison.

       

      The command I used in Yocto is:

      root------my password------rfkill unblock bluetooth ------export PATH=$PATH:~/bluez-5.24/attrib/ ------gatttool -b D2:AD:9F:B7:BB:60 -I -t random ------connect------char-write-req 0xe 0100

       

      When the PIR sensor is triggered, it sends 0x31 (AscII which is char '1' ). And I can now receive it on the command window.

       

      Now the problem is how to script it into Arduino code ?

       

      I tried to use system() call in my arduino sketch like:

       

      void setup() {

       

        Serial.begin(115200);

        system("root");

        system("my password");

        system("rfkill unblock bluetooth");

        system("export PATH=$PATH:~/bluez-5.24/attrib");

        system("gatttool -b D2:AD:9F:B7:BB:60 -I -t random");

        system("char-write-req e 0100");

      }

      void loop() {

        // other code

      }

       

      But it did not work, the bluetooh link is not established as expectation. And I also would like to ask how to display the message I received "0x31"  in the arduino serial port?

       

      Capture.PNG