Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions examples/Check_inputs/Check_inputs.ino

This file was deleted.

42 changes: 42 additions & 0 deletions examples/Tools/Check_Inputs/Check_Inputs.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* This example allows the user to read the
* inputs of the Braccio++ shield UI devices:
* - joystick (up,down,left,right,select)
* - button (enter)
*/

#include <Braccio++.h>

String toMessage(int const input)
{
static String const message[] =
{ "",
"LEFT (Joystick)",
"RIGHT (Joystick)",
"SELECT (Joystick)",
"UP (Joystick)",
"DOWN (Joystick)",
"ENTER (Button)"
};

if (input < 7)
return message[input];
else
return String("Error, invalid input value");
}

void setup()
{
Serial.begin(115200);
while(!Serial){}

Braccio.begin();
Serial.println("Press any button or move the joystick.");
}

void loop()
{
String const message = toMessage(Braccio.getKey());
if(message != "")
Serial.println(message);
delay(100);
}