File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
libraries/BLE/examples/BLE_Broadcast Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include < Arduino.h>
2
+ #include < BLEDevice.h>
3
+ #include < BLEAdvertising.h>
4
+
5
+ // Function Declaration
6
+ void setup_ble (void );
7
+
8
+ // Create Data
9
+ struct IMUData {
10
+ float accelX;
11
+ float accelY;
12
+ float accelZ;
13
+ float gyroX;
14
+ float gyroY;
15
+ float gyroZ;
16
+ };
17
+
18
+ void setup (void ) {
19
+ // Begin Serial
20
+ Serial.begin (115200 );
21
+
22
+ // M5Unified configuration
23
+ auto cfg = M5.config ();
24
+ cfg.internal_imu = true ; // Enable internal IMU
25
+ M5.begin (cfg);
26
+
27
+ // Setup BLE
28
+ setup_ble ();
29
+ }
30
+
31
+ void loop (void ) {
32
+ Serial.println (" Hello World\n " );
33
+ delay (100 );
34
+ }
35
+
36
+ // Function to Setup BLE
37
+ void setup_ble (void ) {
38
+ BLEDevice::init (" M5Capsule" );
39
+ BLEAdvertising *pAdvertising = BLEDevice::getAdvertising ();
40
+ pAdvertising->setScanResponse (true );
41
+ pAdvertising->setMinPreferred (0x06 ); // functions that help with iPhone connections issue
42
+ pAdvertising->setMinPreferred (0x12 );
43
+ BLEDevice::startAdvertising ();
44
+ }
45
+
46
+
You can’t perform that action at this time.
0 commit comments