Hello!
I try to make a controller for a CNC machine, for that i need to emulate Numpad keys, i wired up a simple project box, used some knobs, switches etc. and soldered them together. all components are wired to the same ground together, and each other terminal goes to a different pin, from PIN1 - Pin 10, so total of 10 keys i like to use.
This is how my code looks like:
now the issue is that i get a irradical behavior, like the buttons keep pushing. I tried to change high to low too, same result. It should be Low for shortcircute between ground and pin?
I have removed all the pins once, and still it happens with both read states....
did i fry my board? it worked when i last did it for a flight controller, and now it doesn't work anymore.
Thanks for any suggestions :/
I try to make a controller for a CNC machine, for that i need to emulate Numpad keys, i wired up a simple project box, used some knobs, switches etc. and soldered them together. all components are wired to the same ground together, and each other terminal goes to a different pin, from PIN1 - Pin 10, so total of 10 keys i like to use.
This is how my code looks like:
Code:
#include <Keyboard.h>
void setup() {
pinMode(1, INPUT);
pinMode(2, INPUT);
pinMode(3, INPUT);
pinMode(4, INPUT);
pinMode(5, INPUT);
pinMode(6, INPUT);
pinMode(7, INPUT);
pinMode(8, INPUT);
pinMode(9, INPUT);
pinMode(10, INPUT);
Keyboard.begin();
}
void loop() {
if (digitalRead(0) == HIGH) {Keyboard.press(KEYPAD_2); Keyboard.release(KEYPAD_2);}
if (digitalRead(1) == HIGH) {Keyboard.press(KEYPAD_1); Keyboard.release(KEYPAD_1);}
if (digitalRead(2) == HIGH) {Keyboard.press(KEYPAD_3); Keyboard.release(KEYPAD_3);}
if (digitalRead(3) == HIGH) {Keyboard.press(KEYPAD_7); Keyboard.release(KEYPAD_7);}
if (digitalRead(4) == HIGH) {Keyboard.press(KEYPAD_9); Keyboard.release(KEYPAD_9);}
if (digitalRead(5) == HIGH) {Keyboard.press(KEY_PAGE_UP); Keyboard.release(KEY_PAGE_UP);}
if (digitalRead(6) == HIGH) {Keyboard.press(KEY_PAGE_DOWN); Keyboard.release(KEY_PAGE_DOWN);}
if (digitalRead(7) == HIGH) {Keyboard.press(KEY_3); Keyboard.release(KEY_3);}
if (digitalRead(8) == HIGH) {Keyboard.press(KEY_4); Keyboard.release(KEY_4);}
if (digitalRead(9) == HIGH) {Keyboard.press(KEY_5); Keyboard.release(KEY_5);}
}
now the issue is that i get a irradical behavior, like the buttons keep pushing. I tried to change high to low too, same result. It should be Low for shortcircute between ground and pin?
I have removed all the pins once, and still it happens with both read states....
did i fry my board? it worked when i last did it for a flight controller, and now it doesn't work anymore.
Thanks for any suggestions :/