lab5_caseywojcik


 

PLEASE NOTE -  I attended lab session on Friday instead of my usual Wednesday, so this is not late.

 

 

a.  How can you check you're board is now running at 3.3V? Check it out!

     Using the multimeter to compare Vcc to Gnd, I see that the difference is nearly 3.3V. 

 

  1. a.  With the smaller font, what is the longest message you can write across one line of the display? How many lines can you write?
         14 characters across, 6 lines down. 

  2. a.  Upload a photo of your personal logo, shown on your LCD screen, to your Lab 5 page. 

✔ Very nice logo!!! 

  1. a.  Some of these line assignments overlap with the Graphical LCD line assignments. Why is this? What can (or should) you do about it? 

               Both are serial devices and need clock and other serial communication pins.  I could use a chip select pin to tell each device when I am communicating with it. 

 

          a.  Include the code that you had to insert to do this in your lab writeup. 

             File dataFile = SD.open("datalog.txt", FILE_WRITE); 

             dataFile.write("This is a test of the emergency broadcast system.");

             dataFile.close();

               //the rest remains unchanged

          b.  Explain what would you do differently (or show us your code!) to insert the same text string, but at the beginning of the file (without over-writing the current contents).
               I would seek(0), read the amout which I wanted to write, seek(0), write my string, and repeat until I had reached the end of the file.  I could not do this in one step because of the limited memory of the device. 

 

          a.  Post your code.

               After the initialization, this was my code:
        

  File dataFile = SD.open("datalog.txt");

  int lc = 0;

  if (dataFile) {

    while (dataFile.available()) {

      lcd.writeChar( dataFile.read(), MODE_NORMAL);

      lc ++;

    }

    dataFile.close();

  } else {

    Serial.println("error opening datalog.txt");

  } 

 

          a.  Tell us what you had to change to make this work.

I opened the file for writing when the state changed to logging, and for reading when state changed to playback; I then only had to write() the data to the file, and read() it back.  I didn't have to worry about the memory filling up either.

  1. http://www.youtube.com/watch?v=2Q43pnWy5DI