Created
May 2, 2017 16:59
-
-
Save kelliott121/919ba0eb43ef69846f669c17dceaefb1 to your computer and use it in GitHub Desktop.
Test of Controller Firmware for PiGRRL Switch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum DPad {RIGHT = 2, UP = 3, LEFT = 4, DOWN = 5}; | |
enum Buttons {A = 6, B = 7, X = 8, Y = 9}; | |
void setup() { | |
// Set the DPad buttons to pullup inputs | |
pinMode(RIGHT, INPUT_PULLUP); | |
pinMode(UP, INPUT_PULLUP); | |
pinMode(LEFT, INPUT_PULLUP); | |
pinMode(DOWN, INPUT_PULLUP); | |
// Set the action buttons to pullup inputs | |
pinMode(A, INPUT_PULLUP); | |
pinMode(B, INPUT_PULLUP); | |
pinMode(X, INPUT_PULLUP); | |
pinMode(Y, INPUT_PULLUP); | |
Serial.begin(9600); | |
delay(5000); | |
} | |
void loop() { | |
// Print the Key packet | |
// DPad | |
Serial.print("K:"); | |
Serial.print(digitalRead(RIGHT)); | |
Serial.print(digitalRead(UP)); | |
Serial.print(digitalRead(LEFT)); | |
Serial.print(digitalRead(DOWN)); | |
// Action buttons | |
Serial.print(digitalRead(A)); | |
Serial.print(digitalRead(B)); | |
Serial.print(digitalRead(X)); | |
Serial.println(digitalRead(Y)); | |
delay(10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment