Background;
I have been able to have true NKRO on a custom-keyboard using tactile switches directly from pin to ground w/o resistor; I decided that capacitive touch would be better..
I now have a capacitive touch keyboard consisting of "brass paper clips" directly connected to each Touch pin on the LC. It works great; outstanding and it does send true NKRO.
Here is the code I am using as a reference; (PS I am an economist w/o programming exp of any kind)
1) Can use touch on more than the selected pins? (or are those the only touch pins)
2) I set a variable to be adjusted in the called called tuning to set a sensitivity threashold. I would like to set it with a variable resistor I guess I go from 5v to analog pin and then do a val = analogRead(0); (economist seeking a benchcheck here)
3) I want to make the touch function more sensitive because I want to put the touch sensor (the brass clip or some copper tape) under a graphic or under plastic. Would a resistor make the touch pin more sensitive? If so would would be a good resistor to use?
4) My setup works great on the PC but sucks on Mac. a) the mac is looking for ctrl to recognize and confirgure a new keyboard b) It sees the key commands but stutters (I am guessing because it does not know what kind of keyboard I have. Is there anyway to shake hands with the mac code wise; so it knows I am coming
5) I want to use this mini keyboard on laptops (I understand they may not be grounded); should I hook the ground pin of the teensy to an aligator clip for attachment to a physical ground?
Regards Bart
I have been able to have true NKRO on a custom-keyboard using tactile switches directly from pin to ground w/o resistor; I decided that capacitive touch would be better..
I now have a capacitive touch keyboard consisting of "brass paper clips" directly connected to each Touch pin on the LC. It works great; outstanding and it does send true NKRO.
Here is the code I am using as a reference; (PS I am an economist w/o programming exp of any kind)
Code:
int numkeyspressed = 0;
byte keys[] = {KEY_W, KEY_A, KEY_S, KEY_D, KEY_SPACE, KEY_Q, KEY_E, KEY_R, KEY_I, KEY_J, KEY_K};
int touchit[11];
int tuning = 2000;
int xcount = 0;
void setup() {
Serial.begin(38400);
}
void loop()
{
Keyboard.set_key1(0);
Keyboard.set_key2(0);
Keyboard.set_key3(0);
Keyboard.set_key4(0);
Keyboard.set_key5(0);
Keyboard.set_key6(0);
numkeyspressed = 1;
touchit[0] = touchRead(A9);
touchit[1] = touchRead(A8);
touchit[2] = touchRead(A5);
touchit[3] = touchRead(A4);
touchit[4] = touchRead(A3);
touchit[5] = touchRead(A2);
touchit[6] = touchRead(A1);
touchit[7] = touchRead(0);
touchit[8] = touchRead(1);
touchit[9] = touchRead(3);
touchit[10] = touchRead(4);
xcount = 0;
for (int i = 0; i <= 10; i++) {
if (touchit[i] > tuning) {
xcount = xcount + 1;
// Serial.println(i);
switch (xcount) {
case 1:
Keyboard.set_key1(keys[i]);
//Serial.println(touchit[i]);
break;
case 2:
Keyboard.set_key2(keys[i]);
break;
case 3:
Keyboard.set_key3(keys[i]);
break;
case 4:
Keyboard.set_key4(keys[i]);
break;
case 5:
Keyboard.set_key5(keys[i]);
break;
case 6:
Keyboard.set_key6(keys[i]);
break;
}
}
if (xcount > 6) {
xcount = 6;
}
}
//Serial.println("xcount");
//Serial.println(xcount);
Keyboard.send_now();
delay(100);
}
1) Can use touch on more than the selected pins? (or are those the only touch pins)
2) I set a variable to be adjusted in the called called tuning to set a sensitivity threashold. I would like to set it with a variable resistor I guess I go from 5v to analog pin and then do a val = analogRead(0); (economist seeking a benchcheck here)
3) I want to make the touch function more sensitive because I want to put the touch sensor (the brass clip or some copper tape) under a graphic or under plastic. Would a resistor make the touch pin more sensitive? If so would would be a good resistor to use?
4) My setup works great on the PC but sucks on Mac. a) the mac is looking for ctrl to recognize and confirgure a new keyboard b) It sees the key commands but stutters (I am guessing because it does not know what kind of keyboard I have. Is there anyway to shake hands with the mac code wise; so it knows I am coming
5) I want to use this mini keyboard on laptops (I understand they may not be grounded); should I hook the ground pin of the teensy to an aligator clip for attachment to a physical ground?
Regards Bart