File tree Expand file tree Collapse file tree 1 file changed +6
-21
lines changed
examples/Tools/Check_Inputs Expand file tree Collapse file tree 1 file changed +6
-21
lines changed Original file line number Diff line number Diff line change 6
6
7
7
#include < Braccio++.h>
8
8
9
- String toMessage (int const input)
10
- {
11
- static String const message[] =
12
- { " " ,
13
- " LEFT (Joystick)" ,
14
- " RIGHT (Joystick)" ,
15
- " SELECT (Joystick)" ,
16
- " UP (Joystick)" ,
17
- " DOWN (Joystick)" ,
18
- " ENTER (Button)"
19
- };
20
-
21
- if (input < 7 )
22
- return message[input];
23
- else
24
- return String (" Error, invalid input value" );
25
- }
26
-
27
9
void setup ()
28
10
{
29
11
Serial.begin (115200 );
@@ -35,8 +17,11 @@ void setup()
35
17
36
18
void loop ()
37
19
{
38
- String const message = toMessage (Braccio.getKey ());
39
- if (message != " " )
40
- Serial.println (message);
20
+ if (Braccio.isJoystickPressed_LEFT ()) Serial.println (" LEFT (Joystick)" );
21
+ if (Braccio.isJoystickPressed_RIGHT ()) Serial.println (" RIGHT (Joystick)" );
22
+ if (Braccio.isJoystickPressed_SELECT ())Serial.println (" SELECT (Joystick)" );
23
+ if (Braccio.isJoystickPressed_UP ()) Serial.println (" UP (Joystick)" );
24
+ if (Braccio.isJoystickPressed_DOWN ()) Serial.println (" DOWN (Joystick)" );
25
+ if (Braccio.isButtonPressed_ENTER ()) Serial.println (" ENTER (Button)" );
41
26
delay (100 );
42
27
}
You can’t perform that action at this time.
0 commit comments