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 66
77#include < Braccio++.h>
88
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-
279void setup ()
2810{
2911 Serial.begin (115200 );
@@ -35,8 +17,11 @@ void setup()
3517
3618void loop ()
3719{
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)" );
4126 delay (100 );
4227}
You can’t perform that action at this time.
0 commit comments