Go Down

Topic: Using the PS2keyboard library example from playground (Read 689 times) previous topic - next topic

doctorwho8

Hello!
I copied the code from the playground library, and pasted it to a blank sketch. I also remembered to download and install the library code from the Playground entry here: http://playground.arduino.cc/Main/PS2Keyboard

The code of course is also there, but here it is:
Code: [Select]

#include <PS2Keyboard.h>

#define DATA_PIN 4
PS2Keyboard keyboard;

void setup() {
  keyboard.begin(DATA_PIN);

  Serial.begin(9600);
  Serial.println("hi");
  delay(1000);
}

void loop() {
  if(keyboard.available()) {
    byte dat = keyboard.read();
    byte val = dat - '0';

    if(val >= 0 && val <= 9) {
      Serial.print(val, DEC);
    } else if(dat == PS2_KC_ENTER) {
      Serial.println();
    } else if(dat == PS2_KC_ESC) {
      Serial.println("[ESC]");
    }
  }
}


And it then presented me with an error:
Code: [Select]

In file included from sketch_oct23a.ino:1:
C:\Users\GCL.CMDRSKYWALKER\Documents\Arduino\libraries\PS2Keyboard/PS2Keyboard.h:56: error: 'byte' does not name a type
C:\Users\GCL.CMDRSKYWALKER\Documents\Arduino\libraries\PS2Keyboard/PS2Keyboard.h:83: error: 'byte' does not name a type
sketch_oct23a.ino: In function 'void loop()':
sketch_oct23a:16: error: 'class PS2Keyboard' has no member named 'read'


And I'm going to post a new thread regarding the other PS2 example.

PaulS

Code: [Select]
#include "WProgram.h"
Can you find this header file in your installation (of Arduino IDE) directory? I didn't think so.

The library has not been updated for post 1.0 use. You can do that by changing WProgram to Arduino.

doctorwho8


Code: [Select]
#include "WProgram.h"
Can you find this header file in your installation (of Arduino IDE) directory? I didn't think so.

The library has not been updated for post 1.0 use. You can do that by changing WProgram to Arduino.


Hello!
Find what? I just did find it and change it. Part of the problem is that I needed to open it using a different editor, which was Linux based.

Please try to be less pushy or provocative in your responses. Sadly that's my job to annoy and alienate people.

The library page insisted that it was updated. I suspect that the zip file may not have been completely updated.

Nick Gammon


And I'm going to post a new thread regarding the other PS2 example.


You don't really need to do that as they are closely related.

I Googled:

Code: [Select]

Ps2mouse wconstants.h


I got 101,000 hits.

For "PS2keyboard wconstants.h" I got 172,000 hits.

Did you try to look it up yourself?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

doctorwho8



And I'm going to post a new thread regarding the other PS2 example.


You don't really need to do that as they are closely related.

I Googled:

Code: [Select]

Ps2mouse wconstants.h


I got 101,000 hits.

For "PS2keyboard wconstants.h" I got 172,000 hits.

Did you try to look it up yourself?


Hello!
Actually yes I did. And regardless of how deliberately rude the other fellow was and your being very helpful, I did find it. And that one built properly.

I believe I tried to fix things for other one, and found that it was a case of near as made no difference, the problem still was there.

Oddly enough the reason sadly no longer exists as my original project as purpose has ended. (For the other one that is.) For this one, then yes there is a valid purpose.

Thank you Nick, you were very helpful today.

Go Up