1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Data Transfer using BLE among Flutter app & ESP32 (flutter_blue_plus)

Discussão em 'Mobile' iniciado por Stack, Outubro 10, 2024 às 03:12.

  1. Stack

    Stack Membro Participativo

    I'm a newbie to Flutter and do want a simple functionality wherein I want to be able to send some data to the ESP32 after establishing the communication successfully, As of now, I can connect to the ESP32 without any issues, but I can't figure out how to get it to send data to the ESP32.

    Future<bool> connectToDevice(String bleAddress) async {
    try {
    // Create a BluetoothDevice instance using the BLE address
    final device = BluetoothDevice(remoteId: DeviceIdentifier(bleAddress));

    await device.connect();
    print('Connected to $bleAddress');

    return true;
    } catch (e) {
    print('Error connecting to device: $e');
    return false;
    }
    }


    I'm connecting to devices using their Bluetooth Address & it seems to work just fine, (I've added log statements on the ESP to display when a connection is established) but I'm not sure about sending the data , can someone explain how this can be done.

    • I've checked my ESP32's functionality part using a BLE Scanner , also sending the data so there are no issues on the receiving end.

    Continue reading...

Compartilhe esta Página