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

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

Lab 5 Questions - Bertics (1)

Page history last edited by Scott Bertics 9 years, 3 months ago

Scott Bertics

7-15-11

EE 47

Lab 5 Questions

 

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

I read the voltage difference between power and ground on the multimeter.

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?

The smallest font has a width of six pixels, so I can write up to 14 characters across. The screen allows 6 lines vertically.

 

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

My Simple Logo:

 

 

Some of these line assignments overlap with the Graphical LCD line assignments! 

a. Why is this? What can (or should) you do about it?

The MOSI and SCK pins on the SD card share Teensy output pins with the graphical LCD. This is perfectly fine and nothing has to be done.

 

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

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

if(myFile){

myFile.println("He who shall not be named!!!");

myFile.close();

}else{

Serial.println("ERROR 5769j-0 has occurred in writing to the file.");

}

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 use the seek(); command as demonstrated below.

 

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

if(myFile){

myFile.seek(0);

myFile.println("He who shall not be named!!!");

myFile.close();

}else{

Serial.println("ERROR 5769j-0 has occurred in writing to the file.");

}

Merge your code from the Section A above and your code from step 3. above to output data from the text file on the microSD card to your graphical LCD.

a. Post your code.

 

This code fills the entire screen with text.

 

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

// if the file is available, write to the serial port:

if (dataFile) {

while (dataFile.available()) {

lcd.write(dataFile.read());

}

dataFile.close();

}

// if the file isn't open, pop up an error:

else {

lcd.println("Error opening datalog.txt");

}

}

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

It was actually simple to modify my data logger to work with an SD card. Instead of using the commands EEPROM.read() and EEPROM.write(), I could use the commands SD.print() and SD.read(). Instead of using the address variable in the read() and write() functions of the EEPROM, I used the same variable in the seek() command of the SD library.

 

Comments (0)

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