Pages: [1]   Go Down
Author Topic: An other PS2 keyboard problem  (Read 992 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

I try to use the library "PS2Keyboard" with a freeduino v1.16 and a MiniDIN 6-Pin Connector from Sparkfun.

I connect the miniDIN to the freeduino like this


I use this code (from exemple) :
Code:
#include <PS2Keyboard.h>

const int DataPin = 8;
const int IRQpin =  5;

PS2Keyboard keyboard;

void setup() {
  delay(1000);
  keyboard.begin(DataPin, IRQpin);
  Serial.begin(9600);
  Serial.println("Keyboard Test:");
}

void loop() {
  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);
    }
  }
}

Problem : When i upload the code, i just gest the message "Keyboard Test:" in the serial console  and 3 dels of the keyboard once flash (as when we start a pc). That's all...

Any idea of the problem ? Is-there a problem between my connector and my freeduino ?

Thanks in advance  


Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

up  :smiley
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you richard, i will try to be clearer with this schema :

And this is the example schema of the library :


Ground and +v are OK because  3 dels of the keyboard once flash (as when we start a pc).

Any ideas ?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@Richard Crowley At the bottom of you page http:// http://www.arduino.cc/playground/Main/PS2Keyboard, there is a link to the latest version of this library "EDITED AGAIN - Actually mostly rewritten - Version 2.0" : http://www.pjrc.com/teensy/td_libs_PS2Keyboard.html ;

 I try with this library from the begining...  

On the wiki page, thez say : "The PS2Keyboard library uses one of the two available external interrupts to react on keyboard input. Once such input is received, it's stored in a one-byte buffer and is available to be read."

There is a special PIN on arduino board for interrupt ? Or any digital PIN ?
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 13
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

SOLVE

Finnaly, i use this version :

Quote
EDITED VERSION FOR EASY ASSIGNEMENT OF THE IRQ PIN
Download with example code from this link: http://www.megaupload.com/?d=MN6A8JC0

It's works, but the keymap is wrong with my azerty keyboard.
Logged

Pages: [1]   Go Up
Jump to: