Go Down

Topic: Displaying stored eeprom data on Parallax 2x16 Dsiplay (Read 1 time) previous topic - next topic


Hi -

I have created a Simon game to where I am writing the high score to the eeprom (the high score is the number of rounds a user makes it though).  I have not had a problem creating the code to store the data:

Code: [Select]
  if (turn > highscore)
    highscore = turn;
    EEPROM.write(0, highscore); //write highscore to eeprom

The data is being stored correctly.  the problem is when I go to display the data on my Parallax LCD (27977-RT).  The code I have written is displaying the ASCII character, not the number that is stored. 

Code: [Select]
void displayhighscore() {
    highscore = EEPROM.read(0);
    mySerial.write(12);      //clear display     
    mySerial.print(" High Score is");  // First line
    mySerial.write(13);    // Form feed
    mySerial.print("    ");
    mySerial.write (highscore);
    mySerial.print(" rounds");   // Second line
    mySerial.write(12);                 // Clear   
    mySerial.print("Here we go...");  // First line
    mySerial.write(13);                 // Form feed

In other words, if the stored number in memory address is 58, the parallax displays the ":" symbol (this is the ASCII chr value for 58).

I have tried many variations using the INT , CHR  and other commands but can't seem to get "58" to display on the Parallax.

Since I'm new to Arduino  I'm sure I am making a rookie mistake.  Can someone help?


Code: [Select]
    mySerial.write (highscore);
write() is for sending binary data. print() is for converting binary data to strings and sending the string.

So, if highscore contains 58, write(highscore) sends the value 58, while print(highscore) sends the value "58".

The art of getting good answers lies in asking good questions.


Go Up