Created
August 27, 2012 07:05
-
-
Save joksan/3486389 to your computer and use it in GitHub Desktop.
Codigo para la alfombra de baile de Grupo Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment