Skip to content

Instantly share code, notes, and snippets.

@dheaney
Created December 26, 2012 19:09
Show Gist options
  • Save dheaney/4382322 to your computer and use it in GitHub Desktop.
Save dheaney/4382322 to your computer and use it in GitHub Desktop.
Joystick "Top Hat" logic
#include "JoystickDriver.c"
task main() {
while(true) {
if( joystick.joy1_TopHat == 0 ) {
// top button pressed
}
if( joystick.joy1_TopHat == 2 ) {
//right button pressed
}
if( joystick.joy1_TopHat == 4 ) {
//bottom button pressed
}
if( joystick.joy1_TopHat == 6 ) {
//left button pressed
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment