We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ad3d994 commit af97682Copy full SHA for af97682
examples/SetBatteryLevel/SetBatteryLevel.ino
@@ -0,0 +1,31 @@
1
+/*
2
+ * This example shows how to set the battery level to be reported to the host OS
3
+ *
4
+ * It reduces the power by 1% every 30 seconds
5
6
+ */
7
+
8
+#include <Arduino.h>
9
+#include <BleGamepad.h>
10
11
+BleGamepad bleGamepad;
12
13
+int batteryLevel = 100;
14
15
+void setup()
16
+{
17
+ Serial.begin(115200);
18
+ Serial.println("Starting BLE work!");
19
+ bleGamepad.begin();
20
+}
21
22
+void loop()
23
24
+ if (bleGamepad.isConnected())
25
+ {
26
+ Serial.print("Battery Level Set To: ");
27
+ Serial.println(batteryLevel);
28
+ bleGamepad.setBatteryLevel(batteryLevel);
29
+ delay(30000);
30
+ }
31
0 commit comments