Last active
May 18, 2020 04:17
-
-
Save konsumer/bb658163e5ebe233070504dd67dc9746 to your computer and use it in GitHub Desktop.
Gamecube controller (or DDR Mat) to CV. Install "Nintendo" in arduino library-manager. Attach a DAC to pin 5 for CV out (like this: https://create.arduino.cc/projecthub/Arduino_Scuola/build-a-simple-dac-for-your-arduino-4c00bd)
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
// attach your DAC to this pin | |
#define DAC_PIN 5 | |
#include "Nintendo.h" | |
// Define a Gamecube Controller | |
CGamecubeController GamecubeController(7); | |
void setup() { | |
pinMode(DAC_PIN, OUTPUT); | |
} | |
void loop() { | |
// Try to read the controller data | |
if (GamecubeController.read()) { | |
auto report = GamecubeController.getReport(); | |
// do things with report.a, report.b, report.x, report.y, etc | |
// I'm not sure what buttons/axis are hooked to what pads, but here is an example: | |
if (report.a) { | |
analogWrite(DAC_PIN, 127); // 0 - 255 for 0V - 5V | |
} else { | |
analogWrite(DAC_PIN, 0); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment