Drambit
Active member
I'm building an arcade stick, and I found it easier to solder wires to each side of the Teensy, so although I have only 16 switches and I am actually within the reaches of the software, the pins I'm using are 0, 1, 2, 3, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, and ground.
The example code is written to take pins 0-16 in linear order (I think, I'm still new to this.)
const int numButtons = 16; // 16 for Teensy, 32 for Teensy++
Is there any way to change the code to take 16 pins in completely random order without having to rewire the board?
The example code is written to take pins 0-16 in linear order (I think, I'm still new to this.)
const int numButtons = 16; // 16 for Teensy, 32 for Teensy++
void setup() {
// you can print to the serial monitor while the joystick is active!
Serial.begin(9600);
// configure the joystick to manual send mode. This gives precise
// control over when the computer receives updates, but it does
// require you to manually call Joystick.send_now().
Joystick.useManualSend(true);
for (int i=0; i<numButtons; i++) {
pinMode(i, INPUT_PULLUP);
Is there any way to change the code to take 16 pins in completely random order without having to rewire the board?