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

  • Get control of your email attachments. Connect all your Gmail accounts and in less than 2 minutes, Dokkio will automatically organize your file attachments. You can also connect Dokkio to Drive, Dropbox, and Slack. Sign up for free.


Lab 5 - Enzo Lazo

Page history last edited by Vivien Tsao 6 years, 10 months ago

Part A. Graphical LCD

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

I can write on 6 lines. 14 characters each line. 

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

Part B. microSD Card


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

Before reading and showing the contents of the file, I added the following lines:


  File dataFile = SD.open("datalog.txt",FILE_WRITE);
  if (dataFile) {
    dataFile.println(" He who must not be named!");

3b. 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 save the contents of the file, clear the file, write whatever I wanted to at the beginning of the file and then append what I saved (the original content) after writing into the file.

4a. Post your code.

#include <SPI.h>
#include <SD.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>
Adafruit_PCD8544 display = Adafruit_PCD8544(7,6,5,-1,-1);
//On the Arduino Micro, the SS pin is defined in software as pin 17. 
const int chipSelect = 17;
void setup()
 // Open serial communications and wait for port to open:
  delay(1000); //this 1 second delay isn't strictly speaking necessary, but it seems to smooth over the USB serial monitor a bit. 
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
delay(2000);//Necessary time stop in order for the display and Serial to reset and work properly
  Serial.print("Initializing SD card...");
  pinMode(17, OUTPUT); //set SS pin as output. 
  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
    Serial.println("card not found");
    // don't do anything more:
  Serial.println("card initialized.");

  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  File dataFile = SD.open("datalog.txt");
  // if the file is available, write to it:
  if (dataFile) {
    display.clearDisplay(); //clear all the screen
    while (dataFile.available()) {
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening datalog.txt");
void loop()

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

After including all needed libraries to work with SD cards, Instead of writing on the EEPROM using the functions read() and write(), I am now using the functions to write and read on a SD card.

Part D. Create an Etch-a-Sketch!

a. Upload video of your Etch-a-Sketch in action!

Comments (1)

Vivien Tsao said

at 3:13 pm on Aug 14, 2013

good job. :]

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