LCD + Arduino Yun Datalogger(Bridge) problem


I’m trying to log Data on the SD card and to display them on the LCD screen. I used the standard program “Datalogger” with a few modifications. It always hangs up when I try to initialize the lcd screen and I don’t know why. =(

Thanks in advance :smiley:

#include <FileIO.h>
#include <Wire.h>
#include <Adafruit_MCP23017.h>
#include <Adafruit_RGBLCDShield.h>

Adafruit_RGBLCDShield lcd = Adafruit_RGBLCDShield();
#define ON 0x1
#define OFF 0x6
bool pruef=true;

void setup() {
  // Initialize the Bridge and the Serial
  while (!Serial); // wait for Serial port to connect.
  Serial.println("Filesystem datalogger\n");
  lcd.begin(16, 2);

void loop () {
  // make a string that start with a timestamp for assembling the data to log:
  String dataString;
  dataString += getTimeStamp();
  dataString += " = ";

  // read three sensors and append to the string:
  for (int analogPin = 0; analogPin < 3; analogPin++) {
    int sensor = analogRead(analogPin);
    dataString += String(sensor);
    if (analogPin < 2) {
      dataString += ",";  // separate the values with a comma
  File dataFile ="/mnt/sd/arduino/www/datalog.txt", FILE_APPEND);

  // if the file is available, write to it:
  if (dataFile) {
    // print to the serial port too:
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening datalog.txt");



// This function return a string with the time stamp
String getTimeStamp() {
  String result;
  Process time;
  // date is a command line utility to get the date and the time
  // in different formats depending on the additional parameter
  time.addParameter("+%D-%T");  // parameters: D for the complete date mm/dd/yy
  //             T for the time hh:mm:ss;  // run the command

  // read the output of the command
  while (time.available() > 0) {
    char c =;
    if (c != '\n')
      result += c;

  return result;

check chip select pin for the SD card. They tend to be specific, (sometimes pin-10). If you that pin is already assigned you would have a conflict. I don't know if it is re-assignable.

At the arduino YUN the Access to the SD is controlled by the bridge. So I think this can't be the problem.

before you:
// Initialize the Bridge and the Serial

doesn’t it have to have this?
#include <Bridge.h>

Let me know if I’m wrong, and if you get it working. I will be trying to get an OLED display working with one of these shortly. My hope is to pull logging info from Google Spreadsheet and display on the OLED display.