Auto-Text Entry - skip a line from reading a file?

Status
Not open for further replies.

PBear

Member
I'm using a teensy 2.0 to auto-type some stuff by reading the text from a file. When I get 10-15 characters into a common sentence it completes the typing for me. I am very happy with it but I would like to skip a line in the file on certain occasions. For example my txt file would look like this:

The bear walked to the store.
The dog saw the bear walk to the store.
The cat ran to the house.

I would like to press a key (down arrow) as the keyboard is typing out my file and skip to the next line (or some arbitrary amount of chars ahead) and resume typing from the file.

Here is my current function to type out my file, it just stops typing when I press right arrow:
Code:
void TypeOutFile(char *SomeFile){
  sfile=SD.open(SomeFile);
  while (sfile.available()&&(ps2keyboard.read()!=PS2_RIGHTARROW)){
  delay(145);
  Keyboard.print((char)sfile.read());
  }  
  logfile.close();
}

I'm not much of a coder and just need the syntax to skip a read line or skip the next 50 chars

if ps2keyboard.read()==PS2_DOWNARROW{
sfile.read next line
}

Thanks
 
I got it, I just dumped out the read char until a 'return' was found then resumed printing to the keayboard.
 
Status
Not open for further replies.
Back
Top