Figure 19 Game controller with accelerometer and pushbutton
Now that the hardware is complete, we need a final version of the game con-
troller software. It supports the button we ve added, and it performs the anti-
jittering we created in
MotionSensor/Controller/Controller.ino
#include <Bounce2.h>
const unsigned int
BUTTON_PIN = 7;
const unsigned int
X_AXIS_PIN = A2;
const unsigned int
Y_AXIS_PIN = A1;
const unsigned int
Z_AXIS_PIN = A0;
const unsigned int
NUM_AXES = 3;
const unsigned int
PINS[NUM_AXES] = {
X_AXIS_PIN, Y_AXIS_PIN, Z_AXIS_PIN
};
Finding and Polishing Edge Values, on page
www.it-ebooks.info
Building Your Own Game Controller
103:
107
report erratum
discuss
Need help?
Do you have a question about the Arduino Uno and is the answer not in the manual?