You are so far off what you want to do it is untrue. Try this, it compiles but I have not run it. Also I am not sure what the PS2Keyboard returns as I never use this but assuming it is the simple byte from the keyboard then try this:-
#include "binary.h"
typedef uint8_t boolean;
typedef uint8_t byte;
#include <PS2Keyboard.h>
#define DATA_PIN 4
PS2Keyboard keyboard;
int LEDR = 9;
int LEDG = 10;
int LEDB = 11;
int r1 = 0;
int g1 = 0;
int b1 = 0;
void setup() {
pinMode(LEDR, OUTPUT);
pinMode(LEDG, OUTPUT);
pinMode(LEDB, OUTPUT);
keyboard.begin(DATA_PIN);
Serial.begin(9600);
Serial.println("RGB colour Mixer");
delay(500);
}
int keyIn(){
int val = 0;
byte dat = 0;
while(dat != 0x0d){ // keep doing this till you get a carrage return
while(!keyboard.available()) {
} // hold until there is something to read
dat = keyboard.read();
val = (val * 10) + (int)(dat - '0');
} // end of entry
digitalWrite(LEDR, HIGH); // flash LED to show you have recieved something
delay(10);
digitalWrite(LEDR, LOW);
delay(10);
digitalWrite(LEDR, HIGH);
delay(10);
digitalWrite(LEDR, LOW);
return val;
}
void loop() {
Serial.print("Type R value 0-255");
r1 = keyIn();
Serial.print("Type G value 0-255");
g1 = keyIn();
Serial.print("Type B value 0-255");
b1 = keyIn();
delay(500);
Serial.print(r1);
Serial.print(g1);
Serial.print(b1);
}
If PS2Keyboard does not behave like this just use the normal serial input commands.