Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int mapa_botones[9] = { 5, 6, 7, 8, 9, 10, 16, 14, 15 };
- int BotonesAnt[9] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 };
- int BotonesAct[9] = { 1, 1, 1, 1, 1, 1, 1, 1, 1 };
- void setup() {
- int i;
- for (i=0; i<9; i++) {
- digitalWrite(mapa_botones[i], HIGH);
- pinMode(mapa_botones[i], INPUT);
- }
- Keyboard.begin();
- }
- void loop() {
- int i;
- //Guarda el estado anterior de los botones y los refresca
- for (i=0; i<9; i++) {
- BotonesAnt[i] = BotonesAct[i];
- BotonesAct[i] = digitalRead(mapa_botones[i]);
- }
- //Determina las transiciones en los botones
- for (i=0; i<9; i++) {
- if (!BotonesAnt[i] && BotonesAct[i]) {
- Keyboard.release('a' + i);
- }
- if (BotonesAnt[i] && !BotonesAct[i]) {
- Keyboard.press('a' + i);
- }
- }
- delay(10);
- }
Add Comment
Please, Sign In to add comment