// --------------------------------------------------------
//  Login on PC with RFID-ROM Chip TOWITEC + Arduino Micro. A password-store
//--------------------------------------------------------
//--------start Arduino as USB-Keyboard 
#include "Keyboard.h"
int i;
int z = 0;
int key[5];
String keyvalue;
int bytes_from_RFID = 5;
void setup()
{
Serial1.begin(9600); // start serial to RFID reader
Serial.begin(9600); // start serial to PC
Keyboard.begin();
}
void loop()
{
if (Serial1.available() > 0)
 {
i = Serial1.read();
z ++;
// -------------6 = 5+1(bytes)
if (z < (bytes_from_RFID + 1) )
  {
Serial.print(i, DEC);
Serial.print(" ");
key[z] =i;
// -----------------5 bytes from RFID
if (z == bytes_from_RFID)
   {
 Serial.println();
 Serial1.end();

 keyvalue = (key[1] );
 keyvalue = (keyvalue + key[2]);
 keyvalue = (keyvalue + key[3]);
 keyvalue = (keyvalue + key[4]);
 keyvalue = (keyvalue + key[5]);
 //--------------Put in the 5 bytes provided by serial monitor without spaces!
 if (keyvalue == 12345)
   {
//------- Put in your password. \n after password means Newline or ENTER
 Keyboard.print("topsecretPW\n");
   }
// -----------------5 Seconds lock
 delay(5000);
//--------------------Thats not nice but it works.
 Serial1.begin(9600);
 
z=0;
   }
  }
 }
}
// ---------------------------------