indentifying conflicts


hello all.
i'm driving 16 leds tlc5940 , have liquidcrystal_i2c library tell me going on via 16x2 display. leds work way want them to, i'm confident wiring. i've copied wiring , code lcd display successful project i've done.
i have commented out every line of code until found conflict... lcd.begin(). moment uncomment line below (line 36), nothing works. ideas of how go resolving issue or perhaps can can further debug application? i've followed wiring diagram here.
many thanks.
code: [select]
#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;

/* want switch between evens , odds */
  boolean lightupodds=false;

/* debugging */
  boolean maxspeedattained=false;

/* needed timing */
  long previous_milliseconds=0;

/* duration between odds , evens */
  int wait_time=2500;
  int wait_time_reset=wait_time;

/* fastest speed, in milliseconds. smaller number, faster. */
  int max_speed=20;
  int max_speed_reset=max_speed;

/* speed increase... percentage. */
  int speed_increase=10;
  int speed_increase_reset=speed_increase;

/* reporting */
  liquidcrystal_i2c lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, positive);

void setup() {
  /* configure lcd display */
    //lcd.begin(16,2);   // initialize lcd 16 chars 2 lines

  /* set pwm driver */
    tlc.init();

  /* used debugging */
    serial.begin(9600);

  /* set input pins */
    pinmode(btnon, input_pullup);
    pinmode(btnoff, input_pullup);

  /* instructions */
    display_start_instructions();
}

void loop() {
  /*
   get current state of buttons.
   when pressed, set values variables read elsewhere.
  */
    if (digitalread(btnon) == low) {
      ok_to_send = 1;
    }
    if (digitalread(btnoff) == low) {
      ok_to_send = 0;
      reset_everything();
    }
  /* call function lights leds*/
    sendsignals();
}

void sendsignals() {
  if(ok_to_send==1) {
  /* 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 in 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 interval between odds/evens percentage (speed_increase). */
        if(wait_time>=max_speed) {
          /* speed interval */
            wait_time-=(wait_time/speed_increase);
        }
      /* update pwm driver */
        tlc.update();
      /* 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 execute code more 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 button");
}

void reset_everything() {
  /* reset pwm driver */
    tlc.clear();
    tlc.update();
  /* these variables , functions put 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 lcd library come (links) seems way many parameters i2c backpacked lcd. more normal lcd 4 pin data bus.
code: [select]
liquidcrystal_i2c lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, positive);


Arduino Forum > Using Arduino > Project Guidance > indentifying conflicts


arduino

Comments