[SOLVED]LCD 16x2 showing garbage

Hi, i have and LCD 16x2 connected to my Leonardo. I works properly with all the examples son the connection is ok. But I add the LCD to another sketch and it's just showing garbage, and i have no idea why. I just want to show "Writing:" in the first row, and the variable nombrearchivo in the second row. All of this works using serial, so my only problem is the LCD.

Here is the code

#include <LiquidCrystal.h>
#include <SdFat.h>
SdFat sd;
SdFile myFile;
#include "Wire.h"
#define DS1307_I2C_ADDRESS 0x68  // This is the I2C address


// Global Variables
const int chipSelect = 4;
int command = 0;       // This is the command char, in ascii form, sent from the serial port     
int i;
int second, minute, hour, dayOfWeek, dayOfMonth, month, year;
byte test;
byte zero;
char nombrearchivo[13];
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// Convert normal decimal numbers to binary coded decimal
byte decToBcd(byte val)
{  return ( (val/10*16) + (val%10) );}

// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{  return ( (val/16*10) + (val%16) );}
 
// 1) Sets the date and time on the ds1307
// 2) Starts the clock
// 3) Sets hour mode to 24 hour clock
// Assumes you're passing in valid numbers, Probably need to put in checks for valid numbers.
// setDateDs1307() solo se necesita una vez, se mantiene el el codigo, por si se debe cambiar la bateria del RTC o modificar la fecha u hora. 
/*void setDateDs1307()                
{
   second = (byte) ((Serial.read() - 48) * 10 + (Serial.read() - 48)); // Use of (byte) type casting and ascii math to achieve result.  
   minute = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   hour  = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   dayOfWeek = (byte) (Serial.read() - 48);
   dayOfMonth = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   month = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   year= (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   Wire.beginTransmission(DS1307_I2C_ADDRESS);
   Wire.write(zero);
   Wire.write(decToBcd(second) & 0x7f);    // 0 to bit 7 starts the clock
   Wire.write(decToBcd(minute));
   Wire.write(decToBcd(hour));      // If you want 12 hour am/pm you need to set
                                   // bit 6 (also need to change readDateDs1307)
   Wire.write(decToBcd(dayOfWeek));
   Wire.write(decToBcd(dayOfMonth));
   Wire.write(decToBcd(month));
   Wire.write(decToBcd(year));
   Wire.endTransmission();
}*/

// Gets the date and time from the ds1307 and prints result
void getDateDs1307()
{
  // Reset the register pointer
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.write(zero);
  Wire.endTransmission();
 
  Wire.requestFrom(DS1307_I2C_ADDRESS, 7);
  
 
  // A few of these need masks because certain bits are control bits
  second     = bcdToDec(Wire.read() & 0x7f);
  minute     = bcdToDec(Wire.read());
  hour       = bcdToDec(Wire.read() & 0x3f);  // Need to change this if 12 hour am/pm
  dayOfWeek  = bcdToDec(Wire.read());
  dayOfMonth = bcdToDec(Wire.read());
  month      = bcdToDec(Wire.read());
  year       = bcdToDec(Wire.read());
  
 
//  if (hour < 10)
//    Serial.print('0');
//  Serial.print(hour, DEC);
//  Serial.print(":");
//  if (minute < 10)
//    Serial.print("0");
//  Serial.print(minute, DEC);
//  Serial.print(":");
//  if (second < 10)
//    Serial.print("0");
//  Serial.print(second, DEC);
//  Serial.print(", ");
//  if (dayOfMonth < 10)
//    Serial.print('0');
//  Serial.print(dayOfMonth, DEC);
//  Serial.print(" ,");
//  Serial.print(month, DEC);
//  Serial.print(" 20");
//  if (year < 10)
//    Serial.print("0");
//  Serial.println(year);
  

  
  snprintf(nombrearchivo,13,"%02d%02d20%02d.txt", second, month, year); //merge together
  Serial.println(nombrearchivo);
   
  
 
}
 
 
void setup() {
  lcd.begin(16, 2);
  Wire.begin();
  zero=0x00;
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  // set up the LCD's number of columns and rows: 
  
  // Initialize SdFat or print a detailed error message and halt
  // Use half speed like the native library.
  // change to SPI_FULL_SPEED for more performance.
  if (!sd.begin(chipSelect, SPI_HALF_SPEED)) sd.initErrorHalt();
  
}
 
void loop() {
     /*if (Serial.available()) {      // Look for char in serial que and process if found
      command = Serial.read();
      if (command == 84 || command == 116) {      //If command = "Tt" Set Date
       //setDateDs1307();
       getDateDs1307();
       
       
       if (!myFile.open(nombrearchivo, O_RDWR | O_CREAT | O_AT_END)) {
        sd.errorHalt("opening test.txt for write failed");
      }
      // if the file is available, write to it:
      Serial.print("Writing to test.txt...");
      myFile.println("testing 1, 2, 3.");

      // close the file:
      myFile.close();
      Serial.println("done.");

      }
      else if (command == 82 || command == 114) {      //If command = "Rr" Read Date ... BBR
       getDateDs1307();
       Serial.println(" ");
      }
      
      Serial.print("Command: ");
      Serial.println(command);     // Echo command CHAR in ascii that was sent
      }
      command = 0;                 // reset command 
      delay(100);*/
      getDateDs1307();
      year+=2000;
      if (!myFile.open(nombrearchivo, O_RDWR | O_CREAT | O_AT_END)) {
        sd.errorHalt("opening test.txt for write failed");
      }
      // if the file is available, write to it:
      Serial.print("Writing");
      lcd.setCursor(0, 0);
      lcd.print("Writing:");
      lcd.setCursor(0, 1);
      lcd.print(nombrearchivo);
      myFile.println("testing 1, 2, 3.");
      if(!myFile.timestamp(T_WRITE,year,month,dayOfMonth,hour,minute,second)){
      Serial.println("Mod date failed");
      }
      // close the file:
      myFile.close();
      Serial.println("done.");
      lcd.clear();
      delay(250);
      
      
  }

I have a lot of commented sections...

Thanks in advance.

Also, the LCD is this one here 16x2 Parallel LCD Add-On - RTL-09761 - SparkFun Electronics

... and it's just showing garbage ...

Could you be more explicit about the 'garbage'?

  • Do you get the same stuff in the same place each time?
  • Do you get the same amount each time?
    That kind of information will be helpful in troubleshooting.

What you should do first is see if "Writing" is being displayed correctly and is subsequently being obliterated by the garbage. Put a delay immediately after displaying the first line and see if "Writing" is legible during the delay.

  ...
      lcd.setCursor(0, 0);
      lcd.print("Writing:");
                                                  // delay - for debugging
      lcd.setCursor(0, 1);
      lcd.print(nombrearchivo);
  ...

If that is the case then it is the format of the information in 'nombrearchivo' that is the culprit.

Don

Your LCD is using 12,11,...
Your SD card is using 10,11,12,13
So, there is a pin conflict. Use other pins for your LCD.

I get the same symbols in (13,1),(14,1),(15,1) and(16,1), thats it. I put the delay and all I get is different 4 symbols for "Writing:" and different ones for "nombrearchivo".

I changed the setup() sequence and i discovered that it stops working when I gets to Wire.begin().

void setup() {
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  lcd.begin(16, 2);
  lcd.print("Prueba");
  delay(500);
  lcd.clear();
  
  zero=0x00;
  // Open serial communications and wait for port to open:
  
  // set up the LCD's number of columns and rows: 
  lcd.print("Prueba1");
  delay(500);
  lcd.clear();
  
  // Initialize SdFat or print a detailed error message and halt
  // Use half speed like the native library.
  // change to SPI_FULL_SPEED for more performance.
  
  lcd.print("Prueba2");
  delay(500);
  lcd.clear();
  
  
  lcd.print("Prueba3");
  delay(500);
  lcd.clear();
  if (!sd.begin(chipSelect, SPI_HALF_SPEED)) sd.initErrorHalt();
  Wire.begin();
  
}

What can i do? I use this for the RTC code, but I don't know if its necessary. Any ideas?

Ok I'll change that, I wasn't aware that they were the same pins...

I changed the LCD pins to

LiquidCrystal lcd(9, 8, 5, 4, 3, 2);

The same thing happens, I get Prueba, Prueba1, Prueba2 and Prueba3 correctly in the LCD, but Prueba4 prints like garbage, just random symbols. The following setup code gives me this result.

void setup() {
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  lcd.begin(16, 2);
  lcd.print("Prueba");
  delay(500);
  lcd.clear();
  
  zero=0x00;
  // Open serial communications and wait for port to open:
  
  // set up the LCD's number of columns and rows: 
  lcd.print("Prueba1");
  delay(500);
  lcd.clear();
  
  // Initialize SdFat or print a detailed error message and halt
  // Use half speed like the native library.
  // change to SPI_FULL_SPEED for more performance.
  
  lcd.print("Prueba2");
  delay(500);
  lcd.clear();
  
  if (!sd.begin(chipSelect, SPI_HALF_SPEED)) sd.initErrorHalt();
  lcd.print("Prueba3");
  delay(500);
  lcd.clear();
  
  Wire.begin();
  lcd.print("Prueba4");
  delay(500);
  
}

mrescude:
Ok I'll change that, I wasn't aware that they were the same pins...

All SPI devices such as SD card, use the SPI bus pins, 11,12,13. 10 is simply used as chip select to tell the chip the communication is for that chip. Adafruit SD card shield uses 10 so make sure you find which pin sparkfun SD card uses for CS, chip select, could be pin 4, and avoid that pin. FYI the analog pins 0-5 can be used as digital pins 14-19 if you run out of pins.

I'm using the Arduino Ethernet Shield, so CS is pin 10. I get the problem after calling Wire.begin(), and i have no idea how to avoid that, cause I need that to get or set the date from the RTC.

OK, just avoid pin 4 too:

const int chipSelect = 4;

I guess if you use the Ethernet, avoid pin 10 and 4. Since you have RTC on I2C bus, also avoid analog pins 4 and 5 :slight_smile: You don't have many pins left, do you?

Program upload uses 0,1
Ethershield with SD card uses 4,10,11,12,13
RTC uses 18,19 (aka analog 4,5)

So you have left 2,3,5,6,7,8,9,14,15,16,17
You will use 6 of them and have 5 left for the rest of your project, which is what?

but Prueba4 prints like garbage, just random symbols.

It might look like garbage to you but not to others. We have to know exactly what was supposed to be displayed, what was actually displayed, if the correct number of characters were displayed, if the characters are consistent each time, etc.

Don

Don,

I think his/her problem is pin conflict. The pin 4 is used both as chip select for the SD card and the LCD. Let's wait until that is fixed.

This is the last code i tested. I chaged th pins in the LCD to 9,8,7,6,5,3.
I keep getting the same error, it sends correctly Prueba, Prueba1, Prueba2 and Prueba3, but the it calls Wire.begin() everything gets messed up.

#include <LiquidCrystal.h>
#include <SdFat.h>
SdFat sd;
SdFile myFile;
#include "Wire.h"
#define DS1307_I2C_ADDRESS 0x68  // This is the I2C address


// Global Variables
const int chipSelect = 4;
int command = 0;       // This is the command char, in ascii form, sent from the serial port     
int i;
int second, minute, hour, dayOfWeek, dayOfMonth, month, year;
byte test;
byte zero=0x00;
char nombrearchivo[13];
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(9, 8, 7, 6, 5, 3);

// Convert normal decimal numbers to binary coded decimal
byte decToBcd(byte val)
{  return ( (val/10*16) + (val%10) );}

// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{  return ( (val/16*10) + (val%16) );}
 
// 1) Sets the date and time on the ds1307
// 2) Starts the clock
// 3) Sets hour mode to 24 hour clock
// Assumes you're passing in valid numbers, Probably need to put in checks for valid numbers.
// setDateDs1307() solo se necesita una vez, se mantiene el el codigo, por si se debe cambiar la bateria del RTC o modificar la fecha u hora. 
/*void setDateDs1307()                
{
   second = (byte) ((Serial.read() - 48) * 10 + (Serial.read() - 48)); // Use of (byte) type casting and ascii math to achieve result.  
   minute = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   hour  = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   dayOfWeek = (byte) (Serial.read() - 48);
   dayOfMonth = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   month = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   year= (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   Wire.beginTransmission(DS1307_I2C_ADDRESS);
   Wire.write(zero);
   Wire.write(decToBcd(second) & 0x7f);    // 0 to bit 7 starts the clock
   Wire.write(decToBcd(minute));
   Wire.write(decToBcd(hour));      // If you want 12 hour am/pm you need to set
                                   // bit 6 (also need to change readDateDs1307)
   Wire.write(decToBcd(dayOfWeek));
   Wire.write(decToBcd(dayOfMonth));
   Wire.write(decToBcd(month));
   Wire.write(decToBcd(year));
   Wire.endTransmission();
}*/

// Gets the date and time from the ds1307 and prints result
void getDateDs1307()
{
  // Reset the register pointer
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.write(zero);
  Wire.endTransmission();
  Wire.requestFrom(DS1307_I2C_ADDRESS, 7);
  // A few of these need masks because certain bits are control bits
  second     = bcdToDec(Wire.read() & 0x7f);
  minute     = bcdToDec(Wire.read());
  hour       = bcdToDec(Wire.read() & 0x3f);  // Need to change this if 12 hour am/pm
  dayOfWeek  = bcdToDec(Wire.read());
  dayOfMonth = bcdToDec(Wire.read());
  month      = bcdToDec(Wire.read());
  year       = bcdToDec(Wire.read());
  
  snprintf(nombrearchivo,13,"%02d%02d20%02d.txt", second, month, year); //merge together
}
 
 
void setup() {
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  lcd.begin(16, 2);
  lcd.print("Prueba");
  delay(500);
  lcd.clear();
  
  
  // Open serial communications and wait for port to open:
  
  // set up the LCD's number of columns and rows: 
  lcd.print("Prueba1");
  delay(500);
  lcd.clear();
  
  // Initialize SdFat or print a detailed error message and halt
  // Use half speed like the native library.
  // change to SPI_FULL_SPEED for more performance.
  
  lcd.print("Prueba2");
  delay(500);
  lcd.clear();
  
  if (!sd.begin(chipSelect, SPI_HALF_SPEED)) sd.initErrorHalt();
  lcd.print("Prueba3");
  delay(500);
  lcd.clear();
  
  Wire.begin();
  lcd.print("Prueba4");
  delay(500);
  
}
 
void loop() {
     /*if (Serial.available()) {      // Look for char in serial que and process if found
      command = Serial.read();
      if (command == 84 || command == 116) {      //If command = "Tt" Set Date
       //setDateDs1307();
       getDateDs1307();
       
       
       if (!myFile.open(nombrearchivo, O_RDWR | O_CREAT | O_AT_END)) {
        sd.errorHalt("opening test.txt for write failed");
      }
      // if the file is available, write to it:
      Serial.print("Writing to test.txt...");
      myFile.println("testing 1, 2, 3.");

      // close the file:
      myFile.close();
      Serial.println("done.");

      }
      else if (command == 82 || command == 114) {      //If command = "Rr" Read Date ... BBR
       getDateDs1307();
       Serial.println(" ");
      }
      
      Serial.print("Command: ");
      Serial.println(command);     // Echo command CHAR in ascii that was sent
      }
      command = 0;                 // reset command 
      delay(100);*/
      getDateDs1307();
      year+=2000;
      if (!myFile.open(nombrearchivo, O_RDWR | O_CREAT | O_AT_END)) {
        sd.errorHalt("opening test.txt for write failed");
      }
      // if the file is available, write to it:
      Serial.print("Writing");
      lcd.setCursor(0, 0);
      lcd.print("Writing:");
      delay(1000);
      lcd.setCursor(0, 1);
      lcd.print(nombrearchivo);
      myFile.println("testing 1, 2, 3.");
      if(!myFile.timestamp(T_WRITE,year,month,dayOfMonth,hour,minute,second)){
      Serial.println("Mod date failed");
      }
      // close the file:
      myFile.close();
      Serial.println("done.");
      lcd.clear();
      delay(250);
      
      
  }

I'll add some pictures so I can explain myself.

I skipped "Prueba2" and "Prueba3", but they work. I already changed the pins.

From reply #10:
"It might look like garbage to you but not to others. We have to know exactly what was supposed to be displayed, what was actually displayed, if the correct number of characters were displayed, if the characters are consistent each time, etc."
You have responded to one of these points ....

There's no need to clear the LCD each time. Just reposition the cursor and write over the old information.

but Prueba4 prints like garbage, just random symbols.

You haven't shown us this 'garbage' yet.

I think his/her problem is pin conflict. The pin 4 is used both as chip select for the SD card and the LCD. Let's wait until that is fixed.

That could certainly mess up the information on the LCD.

Don

I have been looking at this wrong! This is fellow is using the new leonardo board. Pins 2 and 3 are I2C bus that you use for wire library, avoid these pins instead. All the UNO talk about SPI bus 11,12,13 are irrelavent, except for pin 4 and 10 is still to be avoided. Oh my. Maybe I should get myself a leonardo board now.

That did it, I was using pin 2 for the last bit of the LCD. Thank you very much!

Where can I look at all the pin usage? Maybe this will save me a lot of trouble in the future.

mrescude:
That did it, I was using pin 2 for the last bit of the LCD. Thank you very much!

Where can I look at all the pin usage? Maybe this will save me a lot of trouble in the future.

Look at the middle of the page "input and output". For shields, you should be able to find pin usage where you buy them.

What happened today is a good thing for me. As a shield designer I should have looked at Leonardo. Now that I have, I'll spend some time thinking what to do with my shield update, especially with pins 2 and 3 now.

Well, just in case anyone wants to see the working code... I just changed the pin usage in the LCD to LiquidCrystal lcd(13,12,11,9,8,7),

#include <LiquidCrystal.h>
#include <SdFat.h>
SdFat sd;
SdFile myFile;
#include "Wire.h"
#define DS1307_I2C_ADDRESS 0x68  // This is the I2C address


// Global Variables
const int chipSelect = 4;
int command = 0;       // This is the command char, in ascii form, sent from the serial port     
int i;
int second, minute, hour, dayOfWeek, dayOfMonth, month, year;
byte test;
byte zero=0x00;
char nombrearchivo[13];
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(13,12, 11, 9, 8, 7);

// Convert normal decimal numbers to binary coded decimal
byte decToBcd(byte val)
{  return ( (val/10*16) + (val%10) );}

// Convert binary coded decimal to normal decimal numbers
byte bcdToDec(byte val)
{  return ( (val/16*10) + (val%16) );}
 
// 1) Sets the date and time on the ds1307
// 2) Starts the clock
// 3) Sets hour mode to 24 hour clock
// Assumes you're passing in valid numbers, Probably need to put in checks for valid numbers.
// setDateDs1307() solo se necesita una vez, se mantiene el el codigo, por si se debe cambiar la bateria del RTC o modificar la fecha u hora. 
/*void setDateDs1307()                
{
   second = (byte) ((Serial.read() - 48) * 10 + (Serial.read() - 48)); // Use of (byte) type casting and ascii math to achieve result.  
   minute = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   hour  = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   dayOfWeek = (byte) (Serial.read() - 48);
   dayOfMonth = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   month = (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   year= (byte) ((Serial.read() - 48) *10 +  (Serial.read() - 48));
   Wire.beginTransmission(DS1307_I2C_ADDRESS);
   Wire.write(zero);
   Wire.write(decToBcd(second) & 0x7f);    // 0 to bit 7 starts the clock
   Wire.write(decToBcd(minute));
   Wire.write(decToBcd(hour));      // If you want 12 hour am/pm you need to set
                                   // bit 6 (also need to change readDateDs1307)
   Wire.write(decToBcd(dayOfWeek));
   Wire.write(decToBcd(dayOfMonth));
   Wire.write(decToBcd(month));
   Wire.write(decToBcd(year));
   Wire.endTransmission();
}*/

// Gets the date and time from the ds1307 and prints result
void getDateDs1307()
{
  // Reset the register pointer
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.write(zero);
  Wire.endTransmission();
  Wire.requestFrom(DS1307_I2C_ADDRESS, 7);
  // A few of these need masks because certain bits are control bits
  second     = bcdToDec(Wire.read() & 0x7f);
  minute     = bcdToDec(Wire.read());
  hour       = bcdToDec(Wire.read() & 0x3f);  // Need to change this if 12 hour am/pm
  dayOfWeek  = bcdToDec(Wire.read());
  dayOfMonth = bcdToDec(Wire.read());
  month      = bcdToDec(Wire.read());
  year       = bcdToDec(Wire.read());
  
  snprintf(nombrearchivo,13,"%02d%02d20%02d.txt", second, month, year); //merge together
}
 
 
void setup() {
  Serial.begin(9600);
   while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }
  // set up the LCD's number of columns and rows:  
  lcd.begin(16, 2);
  
  lcd.print("Inicializando...");
  delay(1000);
  lcd.clear();
  // Initialize SdFat or print a detailed error message and halt
  // Use half speed like the native library.
  // change to SPI_FULL_SPEED for more performance.
  
    if (!sd.begin(chipSelect, SPI_HALF_SPEED)){ 
      sd.initErrorHalt();
      lcd.print("SD Error!!!     ");
  
  }
  else{lcd.print("SD Lista!!!     "); }
  delay(500);
  lcd.clear();
  Wire.begin();
  lcd.print("Sist Preparado!!");
  delay(500);
  
}
 
void loop() {
     /*if (Serial.available()) {      // Look for char in serial que and process if found
      command = Serial.read();
      if (command == 84 || command == 116) {      //If command = "Tt" Set Date
       //setDateDs1307();
       getDateDs1307();
       
       
       if (!myFile.open(nombrearchivo, O_RDWR | O_CREAT | O_AT_END)) {
        sd.errorHalt("opening test.txt for write failed");
      }
      // if the file is available, write to it:
      Serial.print("Writing to test.txt...");
      myFile.println("testing 1, 2, 3.");

      // close the file:
      myFile.close();
      Serial.println("done.");

      }
      else if (command == 82 || command == 114) {      //If command = "Rr" Read Date ... BBR
       getDateDs1307();
       Serial.println(" ");
      }
      
      Serial.print("Command: ");
      Serial.println(command);     // Echo command CHAR in ascii that was sent
      }
      command = 0;                 // reset command 
      delay(100);*/
      getDateDs1307();
      year+=2000;
      if (!myFile.open(nombrearchivo, O_RDWR | O_CREAT | O_AT_END)) {
        sd.errorHalt("opening test.txt for write failed");
      }
      // if the file is available, write to it:
      Serial.print("Writing");
      lcd.setCursor(0, 0);
      lcd.print("Escribiendo:    ");
      lcd.setCursor(0, 1);
      lcd.print(nombrearchivo);
      myFile.println("testing 1, 2, 3.");
      if(!myFile.timestamp(T_WRITE,year,month,dayOfMonth,hour,minute,second)){
      Serial.println("Mod date failed");
      }
      // close the file:
      myFile.close();
      Serial.println("done.");
      
      delay(500);
      
      
  }

Thank you! I couldn't have done it without your help.

For shields, you should be able to find pin usage where you buy them.

How about here: --> http://shieldlist.org/

Don