I am using a Teensy 3.1 as an HID Keyboard, and I am trying to read input from 6 different buttons. To save space and make my soldering easier and less time consuming, I tried to create a common ground and input voltage for all of my buttons (3v from the teensy). However, although I have an analog stick sending input and know that the code is correct, I am getting no input from the buttons.
Here is the code I am trying to use (YES, I have tried testing the input with Serial, there is no change):
int a_value = digitalRead(aPin); if(a_value == HIGH) Keyboard.set_key3(KEY_A); int b_value = digitalRead(bPin); if(b_value == HIGH) Keyboard.set_key4(KEY_B); int x_value = digitalRead(xPin); if(x_value == HIGH) Keyboard.set_key5(KEY_X); int y_value = digitalRead(yPin); if(y_value == HIGH) Keyboard.set_key6(KEY_Y); Keyboard.send_now(); // Key 1 and 2 were the Arrow Key sends from analog stick Keyboard.set_key1(0); Keyboard.set_key2(0); Keyboard.set_key3(0); Keyboard.set_key4(0); Keyboard.set_key5(0); Keyboard.set_key6(0);
Here is a diagram of the button setup attached (same colors connect at junctions but don’t with different colors):