Amigos estou com dificuldade em adaptar o teclado PS2 Keyboard  na matriz preciso de uma luz.


void setup(){
m.init(); // module initialize
m.setIntensity(10); // dot matix intensity 0-15
Serial.begin(9600); // serial communication initialize
delay(1000);
keyboard.begin(DataPin, IRQpin);
Serial.println("Keyboard Test:");
}

void loop(){

//while (Serial.available() > 0){
//byte c = Serial.read();
//Serial.println(c, DEC);
//printCharWithShift(c, 100);
if (keyboard.available()) {

// read the next key
char c = keyboard.read();

// check for some of the special keys
if (c == PS2_ENTER) {
Serial.println();
} else if (c == PS2_TAB) {
Serial.print("[Tab]");
} else if (c == PS2_ESC) {
Serial.print("[ESC]");
} else if (c == PS2_PAGEDOWN) {
Serial.print("[PgDn]");
} else if (c == PS2_PAGEUP) {
Serial.print("[PgUp]");
} else if (c == PS2_LEFTARROW) {
Serial.print("[Left]");
} else if (c == PS2_RIGHTARROW) {
Serial.print("[Right]");
} else if (c == PS2_UPARROW) {
Serial.print("[Up]");
} else if (c == PS2_DOWNARROW) {
Serial.print("[Down]");
} else if (c == PS2_DELETE) {
Serial.print("[Del]");
} else {

// otherwise, just print all normal characters
Serial.print(c);
}
}
}
/*
delay(100);
m.shiftLeft(false, true);
*/

void printCharWithShift(char c, int shift_speed){
if (c < 32) return;
c -= 32;
memcpy_P(buffer, CH + 7*c, 7);
m.writeSprite(72, 0, buffer);
m.setColumn(72 + buffer[0], 0);

for (int i=0; i<buffer[0]+1; i++)
{
delay(shift_speed);
m.shiftLeft(false, false);
}
}

void printStringWithShift(char* s, int shift_speed){
while (*s != 0){
printCharWithShift(*s, shift_speed);
s++;

}

}

Exibições: 160

As respostas para este tópico estão encerradas.

Respostas a este tópico

OI CF, boa noite,

parece que falta o inicio do seu code.

Se for postar novamente, ou post na forma de arquivo anexado ou post em site como o www.pastbin.com e post o link

aqui.

Rui

RSS

© 2024   Criado por Marcelo Rodrigues.   Ativado por

Badges  |  Relatar um incidente  |  Termos de serviço