merci de ta réponse, voici le code entier
//CLAVIER GAUCHE
#include "Keypad.h"
int appuye = 13; //témoin appuye touche
int shift = 26; //touche shift
const byte COLS = 8;
const byte ROWS = 8;
char keys[ROWS][COLS] = {
{'b', 'a', '%', 'g', '
,'{','}','"'}, //12 (=) = ê g => F1 $ = $ } => quote simple " => double quote
{'~', 'u', '?', 'h', '=','(',')','m'}, //14 (2) = & (0) = à h => F2 - = - ) =>tabulation m =>quote mysql
{'p', 'i', 'y', 'f', '"','[',']','
[/code]
}, //15 f => F3 ] => cap lock ? a= alt
{'o', 'e', 'x', 'n', ';','/',',','~'}, //16 ~ = arobase n => F4 ! = shift
{'`', '|', ':', 'r', '_','<','
[/code]
,'`'}, //17 (d) => deux point r => F5 q =
{'^', 'c', 'k', 'l', '&','j','{','
[/code]
}, //18 t => F6 j=> quote simple
{'.', 'w', 's', 'v', 'm','#','
[/code]
,'
[/code]
}, //19 (%) = >è d=> debut
{'-', '+', '*', 'z', '>','
[/code]
,'d','
[/code]
}, //20
//w = espace / + = pgup / - = pg down / m = esc / z = alt
//--1--|-2--|-3--|-4-|-5-|-6--| 7 | 8
//SHIFT bit entrée 10
};
byte colPins[COLS] = {0, 1,2,3,4,5,6,7};
byte rowPins[ROWS] = {14, 15, 16, 17, 18, 19, 20, 21};
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
void setup() {
pinMode(appuye, OUTPUT);
pinMode(shift, INPUT_PULLUP);
Serial.begin(9600);
}
void loop() {
char key = keypad.getKey();
int isShift = digitalRead(shift); // read the input pin
Serial.print(isShift);
if (key != NO_KEY) {
if (isShift == 0) //si on appuye sur shift la touche sera en majuscule
{
Keyboard.set_modifier(MODIFIERKEY_SHIFT); //reste appuyer sur shift
Keyboard.send_now();
Keyboard.set_key1(quertyAzerty(key)); //touche minuscule querty en azerty
Keyboard.send_now();
Keyboard.set_modifier(0);
//Keyboard.set_key1(0);
Keyboard.send_now();
} else { //sinon touche minuscule
if (key == '~' || key == '`' || key == '|' ||key == '%'||key == 's'||key == 'v'|| key == 'z' || key == ';'|| key == 'j'|| key == '{'|| key == '[') {
// Keyboard.set_modifier(MODIFIERKEY_CTRL); //reste appuyer sur alt
// Keyboard.send_now();
Keyboard.set_key1(keyCombo(key)); //touche minuscule querty en azerty
Keyboard.send_now();
} else {
Keyboard.set_key1(quertyAzerty(key)); //touche minuscule querty en azerty
Keyboard.send_now();
}
}
Keyboard.releaseAll(); //vider toutes les memoires touches
digitalWrite(appuye, HIGH);
delay(200);
digitalWrite(appuye, LOW);
Serial.print('key');
}
delay(10);
}
char keyCombo(char key)//utilisation touche combinaison non utilisé de côté opposé
{
if (key == '~') {
Keyboard.write(50); // => é
Keyboard.send_now();
}
if (key == '`') {
Keyboard.write(55); //55 > è
Keyboard.send_now();
}
if (key == '^') {
Keyboard.write(91); // ^ touche accent circonflexe
Keyboard.set_key2(KEY_SPACE); //touche minuscule querty en azertyuuu
Keyboard.send_now();
return 0;
}
if (key == '|') {
Keyboard.set_modifier(MODIFIERKEY_ALT|MODIFIERKEY_CTRL);
Keyboard.press('6');
Keyboard.send_now();
// return KEY_SEMICOLON ; // KEY_COMMA => point virgule
}
if (key == '%') {
Keyboard.write(91); // ê touche accent circonflexe
Keyboard.set_key2(KEY_E); //touche minuscule querty en azerty
Keyboard.send_now();
}
if (key == 's') {
Keyboard.set_modifier(MODIFIERKEY_CTRL);
Keyboard.press('s');
Keyboard.send_now();
// return KEY_SEMICOLON ; // KEY_COMMA => point virgule
}
if (key == 'v') {
Keyboard.set_modifier(MODIFIERKEY_CTRL);
Keyboard.press('y');
Keyboard.send_now();
// return KEY_SEMICOLON ; // KEY_COMMA => point virgule
}
if (key == 'z') {
Keyboard.set_modifier(MODIFIERKEY_CTRL);
Keyboard.press('z');
Keyboard.send_now();
// return KEY_SEMICOLON ; // KEY_COMMA => point virgule
}
if (key == ';') {
Keyboard.set_modifier(MODIFIERKEY_ALT|MODIFIERKEY_CTRL);
Keyboard.press('7');
Keyboard.send_now();
}
if (key == 'j') { //alt GR
Keyboard.set_modifier(MODIFIERKEY_ALT|MODIFIERKEY_CTRL);
Keyboard.send_now();
}
if (key == '{') { //alt GR
Keyboard.set_modifier(MODIFIERKEY_ALT|MODIFIERKEY_CTRL);
Keyboard.press('4');
Keyboard.send_now();
}
if (key == '[') { //alt GR
Keyboard.set_modifier(MODIFIERKEY_ALT|MODIFIERKEY_CTRL);
Keyboard.press('5');
Keyboard.send_now();
}
}
char quertyAzerty(char key) { //querty en azerty
//ligne 12 => p é p o è ^
if (key == 'b') {
return KEY_B; // KEY_B
}
if (key == 'p') {
return KEY_P;
}
if (key == 'o') {
return KEY_O;
}
// è combo key
// ^ combo
if (key == 't') {
return KEY_TAB;
}
if (key == '-') {
return KEY_PAGE_DOWN;
}
//13 => a u i e | c espace pg up
if (key == 'a') {
return KEY_Q; // KEY_Q => KEY_A
}
if (key == 'u') {
return KEY_U; // KEY_Q => KEY_A
}
if (key == 'i') {
return KEY_I; // KEY_Q => KEY_A
}
if (key == 'e') {
return KEY_E; // KEY_Q => KEY_A
}
// heat pipde
if (key == 'c') {
return KEY_C; // KEY_Q => KEY_A
}
if (key == 'w') {
return KEY_SPACE;
}
if (key == '+') {
return KEY_PAGE_UP;
}
// ê à y x : k ctr+s esc
//ê combo
if (key == '?') {
return KEY_0;
}
//à combo
if (key == 'y') {
return KEY_Y;
}
if (key == 'x') {
return KEY_X;
}
if (key == ':') {
Keyboard.write(46); // => deux point
Keyboard.send_now();
}
if (key == 'k') {
return KEY_K;
}
//ctrl +s combo
if (key == '*') {
return KEY_ESC;
}
//touche fonction 1 à 6
if (key == 'g') {
return KEY_F1; // KEY_F1
}
if (key == 'h') {
return KEY_F2; // KEY_F2
}
if (key == 'f') {
return KEY_F3; // KEY_F3
}
if (key == 'n') {
return KEY_F4; // KEY_F4
}
if (key == 'r') {
return KEY_F5; // KEY_F5
}
//ctrl + y
//ctrl + z
//touche $ ' " ` _ entrer backdel cap lock
if (key == '
[/code]
) {
Keyboard.write(93); // => simple quote
Keyboard.send_now();
}
if (key == '=') {
Keyboard.write(52); // => simple quote
Keyboard.send_now();
}
if (key == '"') {
Keyboard.write(51); // => simple quote
Keyboard.send_now();
}
// accent grave combo
if (key == '_') {
Keyboard.press('8'); //underscore
Keyboard.send_now();
}
if (key == '&') {
return KEY_ENTER; // KEY_F5
}
if (key == 'm') {
return KEY_BACKSPACE; // KEY_F5
}
if (key == '>') {
return KEY_CAPS_LOCK; // KEY_F5
}
//touche { ( [ / < ALT altGR CTRL
//combo {
if (key == '(') {
Keyboard.write(53);
Keyboard.send_now();
}
//combo crochet
if (key == '/') {
Keyboard.write(62);// touche / 27 point exclamation //62 deux point
Keyboard.send_now();
}
if (key == '<') {
Keyboard.set_modifier(MODIFIERKEY_ALT);
Keyboard.write(60);
Keyboard.send_now();
}
//combo [
return 0;
}
[/code]