Paso 2: Software y conclusiones
Aquí le damos archivo adjunto el '.ino' que he hecho. Encontrarás la biblioteca 'PS2Keyboard.h' en aquí. Disfrútalo./********** #include < PS2Keyboard.h > const int DataPin = 8; PS2Keyboard teclado; void setup() {} void loop() {}
Morse.ino
**********/
const int IRQpin = 2;
Delay(1000);
Keyboard.Begin (DataPin, IRQpin);
}
Si (keyboard.available()) {}
char c = keyboard.read();
Si (c == 'a') {}
p();l();
} else if (c == 'b') {}
l();p();p();p();
} else if (c == 'c') {}
l();p();l();p();
} else if (c == había ') {}
l();p();p();
} else if (c == 'e') {}
p();
} else if (c == 'f') {}
p();p();l();p();
} else if (c == 'g') {}
l();l();p();
} else if (c == 'h') {}
p();p();p();p();
} else if (c == 'i') {}
p();p();
} else if (c == 'j') {}
p();l();l();l();
} else if (c == 'k') {}
l();p();l();
} else if (c == 'l') {}
p();l();p();p();
} else if (c == estoy ') {}
l();l();
} else if (c == ' n ') {}
l();p();
} else if (c == ' o ') {}
l();l();l();
} else if (c == 'p') {}
p();l();l();p();
} else if (c == 'q') {}
l();l();p();l();
} else if (c == 'r') {}
p();l();p();
} else if (c == de ') {}
p();p();p();
} else if (c == ' t ') {}
l;
} else if (c == 'u') {}
p();p();l();
} else if (c == 'v') {}
p();p();p();l();
} else if (c == 'w') {}
p();l();l();
} else if (c == 'x') {}
l();p();p();l();
} else if (c == 'y') {}
l();p();l();l();
} else if (c == 'z') {}
l();l();p();p();
} else if (c == '1') {}
p();l();l();l();l();
} else if (c == '2') {}
p();p();l();l();l();
} else if (c == '3') {}
p();p();p();l();l();
} else if (c == '4') {}
p();p();p();p();l();
} else if (c == '5') {}
p();p();p();p();p();
} else if (c == '6') {}
l();p();p();p();p();
} else if (c == '7') {}
l();l();p();p();p();
} else if (c == '8') {}
l();l();l();p();p();
} else if (c == '9') {}
l();l();l();l();p();
} else if (c == '0') {}
l();l();l();l();l();
} else if (c == ' ') {}
pausa();
} else {}
tono (4, 300, 250); tono de error
}
}
}
nula p() {//dot
digitalWrite (12, HIGH);
tono (4, 700);
Delay(250);
digitalWrite (12, bajo);
noTone(4);
Delay(250);
}
l vacío {//dash
digitalWrite (12, HIGH);
tono (4, 700);
Delay(750);
digitalWrite(12,LOW);
noTone(4);
Delay(250);
}
void pausa() {//pause entre dos letras
Delay(1750);
}
Si usted tiene cualquier tipo de problemas, deja un comentario