indentifying conflicts

Hello all.
I’m driving 16 LEDs with a Tlc5940 and I would like to have the LiquidCrystal_I2C library tell me what is going on via a 16x2 display. The LEDs work the way I want them to, so I’m fairly confident with the wiring. I’ve also copied my wiring and code for the LCD display from another successful project I’ve done.
I have commented out every line of code until I found the conflict… lcd.begin(). The moment I uncomment that line below (line 36), nothing works. Any ideas of how I would go about resolving this issue or perhaps I can can further debug this application? I’ve followed the wiring diagram here.
Many thanks.

#include <Tlc5940.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

/* BUTTON VARIABLES */
  int ok_to_send=0;
  const int btnOn=5;
  const int btnOff=4;

/* I WANT TO SWITCH BETWEEN EVENS AND ODDS */
  boolean lightUpOdds=false;

/* FOR DEBUGGING */
  boolean maxSpeedAttained=false;

/* NEEDED FOR TIMING */
  long previous_milliseconds=0;

/* THIS IS THE DURATION BETWEEN ODDS AND EVENS */
  int wait_time=2500;
  int wait_time_reset=wait_time;

/* THE FASTEST SPEED, IN MILLISECONDS. THE SMALLER THE NUMBER, THE FASTER. */
  int max_speed=20;
  int max_speed_reset=max_speed;

/* THE SPEED INCREASE... A PERCENTAGE. */
  int speed_increase=10;
  int speed_increase_reset=speed_increase;

/* FOR REPORTING */
  LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

void setup() {
  /* CONFIGURE THE LCD DISPLAY */
    //lcd.begin(16,2);   // initialize the lcd for 16 chars 2 lines

  /* SET UP THE PWM DRIVER */
    Tlc.init();

  /* USED FOR DEBUGGING */
    Serial.begin(9600);

  /* SET THE INPUT PINS */
    pinMode(btnOn, INPUT_PULLUP);
    pinMode(btnOff, INPUT_PULLUP);

  /* INSTRUCTIONS */
    display_start_instructions();
}

void loop() {
  /*
   GET THE CURRENT STATE OF THE BUTTONS.
   WHEN PRESSED, SET VALUES TO VARIABLES READ ELSEWHERE.
  */
    if (digitalRead(btnOn) == LOW) {
      ok_to_send = 1;
    }
    if (digitalRead(btnOff) == LOW) {
      ok_to_send = 0;
      reset_everything();
    }
  /* CALL THE FUNCTION WHICH LIGHTS THE LEDS*/
    sendSignals();
}

void sendSignals() {
  if(ok_to_send==1) {
  /* FOR COMPARING TIME */
    unsigned long current_milliseconds=millis();
  /* USE VARIABLES INSTEAD OF delay() */
    if(current_milliseconds-previous_milliseconds >= wait_time) {
      /* RESET */
        previous_milliseconds=current_milliseconds;
      /* CLEAR OUT EVERYTHING IN THE 16-CHANNEL PWM DRIVER */
        Tlc.clear();
      /* EVENS OR ODDS? */
        if(lightUpOdds==true) {
          for(int i=0; i<16; i++) {
            if(i%2!=0) {
              Tlc.set(i, 4095);
            }
          }
          lightUpOdds=false;
        } else {
          for(int i=0; i<16; i++) {
            if(i%2==0) {
              Tlc.set(i, 4095);
            }
          }
          lightUpOdds=true;
        }
      /* DECREASE THE INTERVAL BETWEEN ODDS/EVENS BY A PERCENTAGE (speed_increase). */
        if(wait_time>=max_speed) {
          /* SPEED UP THE INTERVAL */
            wait_time-=(wait_time/speed_increase);
        }
      /* UPDATE THE PWM DRIVER */
        Tlc.update();
      /* FOR DEBUGGING */
        if(wait_time>=max_speed) {
          debug_wait_time();
        } else {
          debug_max_speed();
        }
    }
  }
}

void debug_wait_time() {
  if(maxSpeedAttained==false) {
    /* LCD MONITORING */
      //lcd.clear();
      //lcd.setCursor(0,0);
      //lcd.print("wait time: ");
      //lcd.print(wait_time);
  }
}

void debug_max_speed() {
  if(maxSpeedAttained==false) {
    /* NO NEED TO EXECUTE THIS CODE MORE THAN ONCE */
      maxSpeedAttained=true;
    /* LCD MONITORING */
      //lcd.clear();
      //lcd.setCursor(0,0);
      //lcd.print("max speed: ");
      //lcd.print(max_speed);
      //lcd.print("ms");
      //lcd.setCursor(0,1);
      //lcd.print("2nd btn resets");
  }
}

void display_start_instructions() {
  /* INSTRUCTIONS */
    //lcd.clear();
    //lcd.setCursor(0,0);
    //lcd.print("press the button");
}

void reset_everything() {
  /* RESET THE PWM DRIVER */
    Tlc.clear();
    Tlc.update();
  /* THESE VARIABLES AND FUNCTIONS BASICALLY PUT EVERYTHING BACK TO THEIR ORIGINAL STATES */
    lightUpOdds=false;
    maxSpeedAttained=false;
    previous_milliseconds=0;
    wait_time=wait_time_reset;
    max_speed=max_speed_reset;
    speed_increase=speed_increase_reset;
    display_start_instructions();
}

Where did the LCD library come from (links) as this seems way to many parameters for an I2C backpacked LCD. More like a normal LCD with a 4 pin data bus.

LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

Unfortunately it is not unusual for Arduino libraries to conflict with each other. Partly this is because there are limited resources and two pieces of code can't use the same thing at the same time.

More unfortunately it is not usual for authors of libraries to list the resources the library uses so that you can easily see what might cause the conflict. You can, of course, examine the source code yourself -but that requires more knowledge of programming than many users possess.

I'm not familiar with the libraries you are using so I can't offer any suggestions.

In some other cases of conflict the problem is that two libraries try to use the same Timer - eg. Servo and SoftwareSerial.

...R

Have you tried the obvious?

Put Tlc.init(); which may be badly written

before lcd.begin(16,2),

No guarantees, just a thought.

Hi Paul__B. Yep, I tried switching the two, thanks. Those two libraries just don't like each other.

Thanks Robin2.

Hi Riva, the LCD library came from here.

I guess I could chain two arduinos together via the RX and TX and have one simply for reporting. Or I could send status messages out through the Serial.

In the PHP world there is a function, debug_backtrace(), which when used in combination with a die or return statement can provide some useful information as to what was fired off when. I guess arduino doesn't have that level of debugging yet.

Thanks folks.

kyled: Hi Riva, the LCD library came from here.

Okay, next question is where did you get the LCD and the I2C backpack from to confirm the pin numbers match what's needed. Did you delete all other LCD libraries as mentioned in the page you linked to. Have you confirmed the I2C address is correct? Have you done a simple sketch to print something on just the LCD with nothing else attached or code not needed by LCD?