Skip to content

Commit 3ca4cee

Browse files
authored
New example
1 parent 53490ed commit 3ca4cee

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

examples/TestAll/TestAll.ino

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Test all gamepad buttons, axes and dpad
3+
*/
4+
5+
#include <BleGamepad.h>
6+
7+
BleGamepad bleGamepad;
8+
9+
void setup()
10+
{
11+
Serial.begin(115200);
12+
Serial.println("Starting BLE work!");
13+
bleGamepad.begin();
14+
}
15+
16+
void loop()
17+
{
18+
if(bleGamepad.isConnected())
19+
{
20+
Serial.println("Press all buttons one by one");
21+
for(int i = 0 ; i < 32 ; i += 1)
22+
{
23+
bleGamepad.press(pow(2, i));
24+
delay(200);
25+
bleGamepad.release(pow(2, i));
26+
delay(50);
27+
}
28+
29+
Serial.println("Move all axis simultaneously from min to max");
30+
for(int i = -127 ; i < 128 ; i += 1)
31+
{
32+
bleGamepad.setAxes(i*256, i*256, i*256, i*256, i+127, i+127, 0);
33+
delay(50);
34+
}
35+
36+
Serial.println("Send all dpad one by one in an anticlockwise rotation");
37+
for(int i = 8 ; i>= 0 ; i--)
38+
{
39+
bleGamepad.setAxes(0,0,0,0,0,0, i);
40+
delay(500);
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)