• can you show an example code to put on the mdb42q

    You don't need any code on mdb42q at all to do this. You also don't need to 'wait' on MDBT42 side for anything.

    You just need to connect from the pi to the MDBT42 and send JS code to set the GPIO as shown in example https://www.espruino.com/Web+Bluetooth that is the easiest way to do this. There are other ways with custom service on MDBT42 - see e.g. this https://www.espruino.com/BLE+Communicati­ons but this is more complicated. Since you are struggling even with the basics there is no point in doing that as step 1.

    As I see it, the biggest issue for you is how to write code on Pi side to connect and send string like 'LED1.set();\n' to Nordic UART service on MDBT42 (or any custom service if you go for the more complicated solution) . In both cases the Pi side will be similar - connect, write data to some characteristics. If you want reply back then also subscribe to notifications and get output back.

    As for refusing connection from unknown devices check https://www.espruino.com/BLE+Security but I wouldn't worry about that in step 1.

    I think we misunderstanding each other.... :-)

    Yes, there seems to be a lot of misunderstanding on your side in both how BLE works and also what you exactly want to do and how :-)

    And BTW here is example of getting battery via (already suggested) espruino cli command
    http://forum.espruino.com/conversations/­297357/#13369180

About

Avatar for fanoush @fanoush started