Tuesday, 3 May 2022

App Inventor with BLE

 In your App Inventor code you need to add:

otherwise your StringsReceived block will never receive anything.


  • RegisterForStrings – Registers to receive updates when one or more null-terminated strings from a connected BluetoothLE device are changed. Service Unique ID and Characteristic Unique ID are required. The utf16 parameter indicates whether the content should be decoded as UTF-16 (true) or UTF-8 (false) code points when converting to App Inventor strings. Whenever a change is received, the StringsReceived event will be run.

    Parameters:

    • serviceUuid (text) — The unique identifier of the service passed in the read or register call.
    • characteristicUuid (text) — The unique identifier of the characteristic in the read or register call.
    • utf16 (boolean) Interpret the string content as UTF-16 (true) or UTF-8 (false) code points.

call BluetoothLE1 RegisterForStringsserviceUuidcharacteristicUuidutf16

  • RequestMTU – Requests a new minimum transmission unit (MUT) for the BluetoothLE connection. This feature is only supported when both devices support Bluetooth 4.2 or higher. If the MTU is changed successfully, the MTUChanged event will be run. The default MTU is 20.

    This block is intended for advanced apps that need to change the size of the messages sent between the BLE devices. Most developers will not need to adjust this value.

    Parameters:

    • bytes (number) — The desired MTU size.

call BluetoothLE1 RequestMTUbytes


.kodular.io

Platformio ESP32 BLE config.



;debug_tool = esp-prog

;debug_init_break = tbreak setup 

[env:esp32dev]

platform = espressif32

board = esp32dev

framework = arduino

monitor_speed = 115200

upload_speed = 921600


lib_deps = 

nkolban/ESP32 BLE Arduino@^1.0.1

t-vk/ESP32 BLE Keyboard@^0.3.2