🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    M5Stack, Core2 Bluetooth Example Code???

    Scheduled Pinned Locked Moved Arduino
    2 Posts 1 Posters 2.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      SirMichael
      last edited by SirMichael

      I'm trying to get Bluetooth to work with an M5Stack, Core2 AWS to pass Serial Data.

      There is an M5Unified.h example for Bluetooth:
      M5Unified.h Bluetooth Example
      but it's so obfuscated, I can't make heads or tails of how to extract some simple Bluetooth commands out of it. PLUS, I can't get it to compile...

      I've had Bluetooth running on an ESP32 WROOM using BluetoothSerial.h (previous project), it connects and passes data. If I use the same Library on the M5Core2 (with the M5Unified.h, latest version) I can see the M5Stack Bluetooth on my Bluetooth device where I get the data (ICOM IC-705), it's discovered when I search, but it won't connect.

      Using this simple code:

      //ESP32 Specific:
      #include "BluetoothSerial.h"
      
      #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
      #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
      #endif
      
      BluetoothSerial SerialBT;
      void setup()
      {
        Serial.begin(115200);
        SerialBT.begin("IC-705-ESP"); //Bluetooth device name
        Serial.println("The device started, now you can pair it with bluetooth!");
      }
      
      void loop() {
        while(1);
      }
      

      I can connect with the ESP32 WROOM (using ESP32 Dev Module) but it won't work with the M5Stack, Core2.

      Is there something I'm missing, or can someone point me in the direction of some more simplified Bluetooth code for the M5Core2?

      I tried others like one that was:

      #include <M5Stack.h>
      #include <BLEDevice.h>
      #include <BLEUtils.h>
      #include <BLEServer.h>
      #include <BLE2902.h>
      

      but again, that didn't work...

      Sir Michael

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        SirMichael @SirMichael
        last edited by

        I finally figured it out, even after trying all of the examples in the SerialBluetooth.h example directory on the M5Stack Core2.

        I finally found that I had to Initialize the Bluetooth settings on my device, after that, the connections worked find.

        Sir Michael

        1 Reply Last reply Reply Quote 0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        • First post
          Last post