Storing a line (text/data/numbers)

Hi,
I can’t figure out how to Save what I’ve typed,
I am working on project where I use a ps/2 keyboard and want to type on a LCD screen.
here’s my code, hope you can read it :slight_smile:

//include librarys
#include <LiquidCrystal.h>
#include <PS2Keyboard.h>
//initialize the library interface pins
LiquidCrystal lcd(12,11,8,7,6,5);
PS2Keyboard keyboard;

const int DataPin = 4;
const int IRQpin = 3;

unsigned int x = 0;
int y;
int n;
int line;

int charsperline[] = {0,0};

void setup(){
  keyboard.begin(DataPin, IRQpin);
  lcd.begin(16,2);
  Serial.begin(9600);
  Serial.println("Keyboard Available");
  lcd.setCursor(0,0);
  delay(500);
  lcd.print("Display");
  lcd.setCursor(0,1);
  lcd.print("Works");
  delay(500);
  lcd.clear();
  lcd.setCursor(0,0);
}

void loop(){
  readkeywritelcd();
}

void readkeywritelcd(){
  if(keyboard.available()){    
    char c = keyboard.read();
    if(!(c==PS2_ENTER)&&!(c==PS2_BACKSPACE)){
      lcd.write(c);
      x++;
      charsperline[0]++;
    }
    if(x==65535){
      x=1;
    }
    if(x==16||c==PS2_ENTER){
      x=0;
      y=1;
    }
    if(x==16 && y==1){
      lcd.clear();
      x=0;
      y=0;
    }
    if(c==PS2_ESC){
      lcd.clear();
      x=0;
      y=0;
      lcd.setCursor(0,0);
    }
    if(c == PS2_BACKSPACE){
      x--;
      charsperline[0]--;
      lcd.print(" ");
      if(x==65535 && y==1){
        y=0;
        x=charsperline[n];
      }
    }
    lcd.setCursor(x, y);
    Serial.println(x);
    lcd.cursor();
  }
}

I’ve tried to use a Array in some sort of way that it store the data when I press enter, and such data should contain just one line
this try however is not included in the Sketch because I removed it to try something else, which was very messy.
So I hope you all can help me figure it out,
any help would be appreciated.
Thanks in advance, Duality

I can't figure out how to Save what I've typed,

How to Save what you type depends on how long you want to Save the information, and where. Why are you interested in doing more than displaying it on the LCD?

Showing us what you tried, no matter how messy, is better than just saying "it didn't work".

A char array, big enough to hold all the data, can be used, and fairly easily. The only challenging part is keeping track of where to insert the next character, incrementing that value each time a character is added (and adding a NULL after that character), and decrementing it when a backspace is entered (and NULLing the proper position).

Well to tell you the trueth when I posted I already had forgoten what I had done and it was already removed.

I want to save/store the data that I got input from the keyboard because I want to use that data for a Other project and need to store it before I can use it so it's complete. Hope I'm clear here :) the Lcd is 16 characters long so I preferably want to store a textline when I type enter or go next line.

ignore this cause i didn't meen to post in this topic/forum post

I've been trying to read and write to a SD card might this be a idea....

Sure.

Only thing is, I can't get it working

Then, I guess not.

If you posted some code, and described the hardware you have, and how it is connected to the Arduino, and described what isn't working (yes, I know, I ask a lot), we might be able to help.