Report
4 months, 1 week ago.

BLE UART not send data from microbit? need help

Hi to all,

I would like to send some data over BLE UART, but nothing received on other side-> Android micro:bit UART application. this is part of program listing

  1. include "mbed.h"
  2. include "MicroBit.h"
  3. include <string>
  4. include "MicroBitUARTService.h"

MicroBit uBit; MicroBitUARTService *uart; MicroBitSerial serial(USBTX, USBRX);

void onConnected(MicroBitEvent e){

uBit.sleep(1000); uBit.display.scroll("C"); uBit.serial.printf("BT Connected\n\r"); connected=1; uart->send("BT Connected",ASYNC); uBit.sleep(1000); uart->send("BT Connected",SYNC_SLEEP); uBit.sleep(1000); }

int main() { Initialise the micro:bit runtime.

uBit.init();

uBit.messageBus.listen(MICROBIT_ID_BLE, MICROBIT_BLE_EVT_CONNECTED, onConnected);

uBit.messageBus.listen(MICROBIT_ID_BLE, MICROBIT_BLE_EVT_DISCONNECTED, onDisconnected);

uBit.messageBus.listen(MICROBIT_ID_BUTTON_A, MICROBIT_BUTTON_EVT_CLICK, onButtonA);

uBit.messageBus.listen(MICROBIT_ID_BUTTON_B, MICROBIT_BUTTON_EVT_CLICK, onButtonB);

uBit.messageBus.listen(MICROBIT_ID_BUTTON_AB, MICROBIT_BUTTON_EVT_CLICK, onButtonAB);

Note GATT table size increased from default in MicroBitConfig.h

#define MICROBIT_SD_GATT_TABLE_SIZE 0x500

uart = new MicroBitUARTService(*uBit.ble, 32, 32);

release_fiber();

}

is there any example how to send data? any advice? Thanks, Damir

Question relating to:

Resources, programs and examples for the BBC micro:bit
Comment on this question
Be the first to answer this question.

You need to log in to post a question