Code for the space evader game.
Dependencies: N5110 PowerControl mbed
Diff: joystick.cpp
- Revision:
- 1:225522d0dd77
- Parent:
- 0:dd6685f1343e
--- a/joystick.cpp Sun May 10 16:48:46 2015 +0000 +++ b/joystick.cpp Mon May 11 11:44:51 2015 +0000 @@ -2,7 +2,7 @@ @file joystick.cpp @brief Program implementation - +@brief Original code https://developer.mbed.org/users/eencae/code/Joystick/ */ #include "mbed.h" #include "joystick.h" @@ -32,6 +32,9 @@ // calculate direction depending on x,y values // tolerance allows a little lee-way in case joystick not exactly in the stated direction + //Direction matrix modified here depending on the direction tolerence + // +1 is down/right, 0 is centre and -1 is up/left + //modified by Dominic Platt if ( fabs(joystick.y) < DIRECTION_TOLERANCE) { joystick.direction[0] = 0; //middle for y } else if ( joystick.y > DIRECTION_TOLERANCE) {