Created
May 18, 2020 04:50
-
-
Save konsumer/239501a2b29822164f1e8ff684148589 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// attach red pin of GC connector here | |
#define GC_PIN 7 | |
// attach your gate plugs to these pins | |
#define GATE1_PIN 1 | |
#define GATE2_PIN 2 | |
#define GATE3_PIN 3 | |
#define GATE4_PIN 4 | |
#include "Nintendo.h" | |
// Define a Gamecube Controller | |
CGamecubeController GamecubeController(GC_PIN); | |
void setup() { | |
pinMode(GATE1_PIN, OUTPUT); | |
pinMode(GATE2_PIN, OUTPUT); | |
pinMode(GATE3_PIN, OUTPUT); | |
pinMode(GATE4_PIN, OUTPUT); | |
} | |
void loop() { | |
// Try to read the controller data | |
if (GamecubeController.read()) { | |
auto report = GamecubeController.getReport(); | |
// I'm not sure what buttons/axis are hooked to what pads, but here is an example: | |
digitalWrite(GATE1_PIN, report.a ? HIGH : LOW ); | |
digitalWrite(GATE2_PIN, report.b ? HIGH : LOW ); | |
digitalWrite(GATE3_PIN, report.x ? HIGH : LOW ); | |
digitalWrite(GATE4_PIN, report.y ? HIGH : LOW ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment