Basic Teensy 3.0 Keyboard Detection

Hi Everyone,
I've been working on a new project lately, trying to detect keyboard input from a stand alone keyboard connected via a PS2 connection on my teensy. I'm aware there is a PS2 keyboard library (HERE: Arduino Playground - PS2Keyboard ) but I'm not certain that's going to be able to do the same functions I'm looking to do.

I'm hoping to be able to make this PS2 connection an input and detect key strokes coming in from my keyboard into the Teensy. For example, I'd like to do something along the lines of activating PIN 13's led when the enter key is pressed or having it blink if shift enter is pressed.

int ledPin = 13; // LED

void setup()
{pinMode(ledPin, OUTPUT);     // LED as output}

void loop()
{
    if <ENTER PRESSED>
        {
        digitalWrite(ledPin, HIGH);  // turn on LED
		delay (1000);
         }

	if <SHIFT+ENTER PRESSED>
   		{
		digitalWrite(ledPin, HIGH);
		delay(300);
		digitalWrite(ledPin, LOW);
		delay(300);
		digitalWrite(ledPin, HIGH);
		delay(300);
         }
   digitalWrite(ledPin, LOW);        // TURN LED OFF
}

I'm trying to use this as a basic concept to understand how to read key stroke inputs so I could expand from there, but I'm really not certain where to begin. If anyone could point me in the right direction or if they have any code they would recommend I would really appreciate it.

If anyone has advice or if anyone has done anything similar to this I would appreciate you're input.

I've been working on this project all night with little luck, so any input would be greatly appreciated!

I'm trying to pull text off a PS2 keyboard's input and send it to my computer via my Teensy 3.0's keyboard command - sending it via the connected micro USB port. I'm able to send data via the "Keyboard.write ("example text");" command however I'm currently unable to directly pull data from the PS2 Keyboard and Relay it through the Teensy's micro usb port.

With the code below, I'm able to watch the LED flash every time a key on the keyboard is pressed, so it's obviously picking up some data (oddly enough the light turns on and off 3 times per keyboard press although I don't know why)

How can I better configure this to allow a full PS2 keyboard passthrough?

Basic pin layout is as follows:

PS2 Clock --> Teensy Pin 9 (RX2)
PS2 Data --> Teensy Pin 10 (TX2)
PS2 5V --> Teensy 5V
PS2 Ground --> Teensy Ground

int ledPin = 13;

void setup() {                
   pinMode(ledPin, OUTPUT);
   Serial2.begin(9600); //Serial 2 = PS2 
}

void loop() {

   if (Serial2.available() > 0) {
      digitalWrite(ledPin, HIGH);
      int c = Serial2.read();
      Keyboard.write(c); //No output is seen on my computer from this
      //Keyboard.write("TEST"); //If I remove comments on this section I see TEST three times per any keystroke
      delay(100);
      digitalWrite(ledPin, LOW);
      delay(100);
   }
}

i havent worked on this , but i can guide you.

you shared us link there is example code.first make setup then try to upload below code into teensy 3.0 . open serial monitor . Use the playstation keys to monitor the serial window

#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]");
    } 
  }
}

Try using the Teensy PS/2 library from the Teensy website. The latest version supports Teensy 3.0+

I think you'd be far better off asking a question related to the Teensy 3.0 in the PJRC Teensy Forum.

Pete