| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Baik Sam: Lab 5 Make an Etch-a-Sketch

Page history last edited by xyyue@... 8 years, 8 months ago

Make an Etch-a-Sketch!

 

Part A. Graphical LCD

 

a. With the standard font, what is the longest message you can write across one line of the display? How many lines can you write?

 

14 characters and 6 lines.

 

Part B. microSD Card

 

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

 

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

 

 

if (dataF) {

     dataF.println(“He who must not be named!”);

     dataF.close();

     Serial.println("done.");

}

 

else {

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

}

 

dataF= SD.open("datalog.txt");

if (dataF) {

     while (dataF.available()) {

          Serial.write(dataF.read());

          }

     dataF.close();

}

 

else {

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

}

 

}

 

 

 

b. Explain what would you do differently to insert the same text string, but at the beginning of the file (without over-writing the current contents). You don't have to code this: just explain the process. If you're interested and have time make it work, show us your program.

 

     Read entire file into memory, place string at beginning and remake whole file.

 

c. Now tell us if your approach would work if the file were larger than your Arduino's memory (which is 2.5KB). If not, how could you work around that limitation?

 

     Make a new file and place text string inside. Copy contents gradually bit by bit. Delete old file and rename the temporary file.

a. Post your code.

 

5. Modify your data logger code from last lab so that you can write to the microSD card. If you took apart your data logger already, make the changes to your old code that you would need to make it write to the SD card.

 

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

 

     Created 1024 byte long file on sd card and used File.seek.

Comments (1)

xyyue@... said

at 1:45 pm on Aug 11, 2015

Well done.

You don't have permission to comment on this page.