Skip to content

Instantly share code, notes, and snippets.

@konsumer
Created May 18, 2020 04:50
Show Gist options
  • Save konsumer/239501a2b29822164f1e8ff684148589 to your computer and use it in GitHub Desktop.
Save konsumer/239501a2b29822164f1e8ff684148589 to your computer and use it in GitHub Desktop.
// 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