user5165: I have the following code:
#include "LCD12864RSPI.h"
#include "DFrobot_bmp.h"
#include "DFrobot_char.h"

#define AR_SIZE( a ) sizeof( a ) / sizeof( a[0] )
unsigned char wangzhi[]=" www.DFRobot.com ";
unsigned char fused[1024];

void setup()
{
  pinMode(11, OUTPUT);     
  for(int i=0;i<4;i++){
  digitalWrite(11,HIGH);
  delay(1000);
  digitalWrite(11,LOW);
  delay(1000);
  }
  LCDA.initDriverPin(2,7,10); 
  LCDA.Initialise(); // INIT SCREEN  
}
unsigned char* fuse3(unsigned char* a ,unsigned char* b,unsigned char* c){

  int i=0;
  int ac=0;//a counter 
  int bc=0; //b counter 
  int cc=0;//c counter 

  for(int n=0;n<64;n++){
    for(int k=0;k<5;k++){
      fused[i]=a[ac];
       ac++;
       i++;
    }
       for(int k=0;k<5;k++){
        fused[i]=b[bc];
       bc++;
        i++;
    }
        for(int k=0;k<5;k++){
            fused[i]=c[cc];
            cc++;
             i++;
    }
    fused[i]=0x00;
    i++;
  }
  
  return fused;
}
unsigned char* getMatch(int input){
  input = input & 0x000f;
  switch (input){
   case 0: return g0;
   case 1: return g1;
   case 2: return g2;
   case 3: return g3;
   case 4: return g4;
   case 5: return g5;
   case 6: return g6;
   case 7: return g7;
   case 8: return g8;
   case 9: return g9;
   case 10: return plus;
   case 11: return minus;
   case 12: return times;
   case 13: return g1;
   case 14: return g1;
   case 15: return g1;
   default: return g1;
  }
  
}
void displayfuse(int number){
// LCDA.DrawFullScreen(fuse3(getMatch(1),getMatch(2),getMatch(3)));
}
void loop(){
  displayfuse(0x1234);

}

This code is a stripped version of the code I need to run to get a bigger project working. But if it somewhat works than the setup should begin by flashing a LED 4 times before continuing. Currently this works. However as you can see I have commented out the line LCDA.DrawFullScreen(fuse3(getMatch(1),getMatch(2),getMatch(3)));. uncommenting this line causes the LED's to flash continuously rather then just 4 times. The library I'm using can be found here. Does anybody know what is going on? To me the first few lines of a program can be affected by a change somewhere this deep inside the code is a form of dark magic.
Weirdly when I change the setup to the following:
void setup()
{
  pinMode(11, OUTPUT);     
  for(int i=0;i<15;i++){
  digitalWrite(11,HIGH);
  delay(100);
  digitalWrite(11,LOW);
  delay(100);
  }
  for(int i=0;i<4;i++){
  digitalWrite(11,HIGH);
  delay(1000);
  digitalWrite(11,LOW);
  delay(1000);
  }
  LCDA.initDriverPin(2,7,10); 
  LCDA.Initialise(); // INIT SCREEN  
}

it stops flashing completely.
Edit having just reuploaded the code again this time the led just remains on all the time.
edit edit
Now with the following code:
#include "LCD12864RSPI.h"
#include "DFrobot_bmp.h"
#include "DFrobot_char.h"

unsigned char fuse[1024];
void setup()
{

  LCDA.initDriverPin(2,7,10); 

  LCDA.Initialise(); // INIT SCREEN  
  pinMode(11, OUTPUT); 
  digitalWrite(11,HIGH);  
  
}
unsigned char* fuse3(unsigned char* a ,unsigned char* b,unsigned char* c){
 unsigned char* fused =(unsigned char*)malloc(sizeof(char)*1024);

  int i=0;
  int ac=0;//a counter 
  int bc=0; //b counter 
  int cc=0;//c counter 

  for(int n=0;n<64;n++){
    for(int k=0;k<5;k++){
      fused[i]=a[ac];
      ac++;
       i++;
    }
        for(int k=0;k<5;k++){
      fused[i]=b[bc];
      bc++;
       i++;
    }
        for(int k=0;k<5;k++){
      fused[i]=c[cc];
      cc++;
       i++;
    }
    fused[i]=0x00;
    i++;
  }
  return fused;
}
unsigned char* getMatch(int input){

  input = input & 0x000f;

  switch (input){
   case 0: return g0;
   case 1: return g1;
   case 2: return g2;
   case 3: return g3;
   case 4: return g4;
   case 5: return g5;
   case 6: return g6;
   case 7: return g7;
   case 8: return g8;
   case 9: return g9;
   case 10: return plus;
   case 11: return minus;
   case 12: return times;
   case 13: return g1;
   case 14: return g1;
   case 15: return g1;
   default: return g1;
  }
}
void displayfuse(int number){
 LCDA.CLEAR();
   delay(100);

 
 int mask1 = 0xF000;
 int mask2 = 0x0F00;
 int mask3 = 0x00F0;

 int firstnumber = number&mask1>>12;
 int operation = number&mask2>>8;
 int secondnumber= number&mask3>>4;
  
  LCDA.DrawFullScreen(fuse3(getMatch(firstnumber),getMatch(operation),getMatch(secondnumber)));
  delay(5000);
}
void loop(){
  displayfuse(0x1234);
  delay(1000)
}

This causes the led to not turn on but moving the lines where I make pin 11 output and high one up (beyond the  LCDA.Initialise(); // INIT SCREEN ) then the led will turn on. It can also be turned on by commenting out the       LCDA.DrawFullScreen(fuse3(getMatch(firstnumber),getMatch(operation),getMatch(secondnumber))); line.
Magic is happening...

user5168: The 'dark magic' is going to be your program rebooting every time it gets to that line. I would imagine (this isn't a library I know) that you're exceeding an array bound & generating a 'segfault', although it could be that you light up your LCD array & the power draw causes a reboot..
Because the LED flash is at the start of setup, it executes quickly, so generating the appearance of continual flashing when  it re-enters repeatedly.
Your code is going to assign g1[0] when the line in question executes - is g1[] defined to point somewhere valid?

5165: <p>I have the following code:</p>
<pre><code>#include &quot;LCD12864RSPI.h&quot;
#include &quot;DFrobot_bmp.h&quot;
#include &quot;DFrobot_char.h&quot;

#define AR_SIZE( a ) sizeof( a ) / sizeof( a[0] )
unsigned char wangzhi[]=&quot; www.DFRobot.com &quot;;
unsigned char fused[1024];

void setup()
{
  pinMode(11, OUTPUT);     
  for(int i=0;i&lt;4;i++){
  digitalWrite(11,HIGH);
  delay(1000);
  digitalWrite(11,LOW);
  delay(1000);
  }
  LCDA.initDriverPin(2,7,10); 
  LCDA.Initialise(); // INIT SCREEN  
}
unsigned char* fuse3(unsigned char* a ,unsigned char* b,unsigned char* c){

  int i=0;
  int ac=0;//a counter 
  int bc=0; //b counter 
  int cc=0;//c counter 

  for(int n=0;n&lt;64;n++){
    for(int k=0;k&lt;5;k++){
      fused[i]=a[ac];
       ac++;
       i++;
    }
       for(int k=0;k&lt;5;k++){
        fused[i]=b[bc];
       bc++;
        i++;
    }
        for(int k=0;k&lt;5;k++){
            fused[i]=c[cc];
            cc++;
             i++;
    }
    fused[i]=0x00;
    i++;
  }
  
  return fused;
}
unsigned char* getMatch(int input){
  input = input &amp; 0x000f;
  switch (input){
   case 0: return g0;
   case 1: return g1;
   case 2: return g2;
   case 3: return g3;
   case 4: return g4;
   case 5: return g5;
   case 6: return g6;
   case 7: return g7;
   case 8: return g8;
   case 9: return g9;
   case 10: return plus;
   case 11: return minus;
   case 12: return times;
   case 13: return g1;
   case 14: return g1;
   case 15: return g1;
   default: return g1;
  }
  
}
void displayfuse(int number){
// LCDA.DrawFullScreen(fuse3(getMatch(1),getMatch(2),getMatch(3)));
}
void loop(){
  displayfuse(0x1234);

}
</code></pre>
<p>This code is a stripped version of the code I need to run to get a bigger project working. But if it somewhat works than the setup should begin by flashing a LED 4 times before continuing. Currently this works. However as you can see I have commented out the line <code>LCDA.DrawFullScreen(fuse3(getMatch(1),getMatch(2),getMatch(3)));</code>. uncommenting this line causes the LED's to flash continuously rather then just 4 times. The library I'm using can be found <a href="http://www.dfrobot.com/wiki/index.php?title=SPI_LCD_Module_%28SKU:DFR0091%29" rel="nofollow noreferrer">here</a>. Does anybody know what is going on? To me the first few lines of a program can be affected by a change somewhere this deep inside the code is a form of dark magic.</p>
<p>Weirdly when I change the setup to the following:
void setup()</p>
<pre><code>{
  pinMode(11, OUTPUT);     
  for(int i=0;i&lt;15;i++){
  digitalWrite(11,HIGH);
  delay(100);
  digitalWrite(11,LOW);
  delay(100);
  }
  for(int i=0;i&lt;4;i++){
  digitalWrite(11,HIGH);
  delay(1000);
  digitalWrite(11,LOW);
  delay(1000);
  }
  LCDA.initDriverPin(2,7,10); 
  LCDA.Initialise(); // INIT SCREEN  
}
</code></pre>
<p>it stops flashing completely.</p>
<p>Edit having just reuploaded the code again this time the led just remains on all the time.</p>
<p>edit edit
Now with the following code:</p>
<pre><code>#include &quot;LCD12864RSPI.h&quot;
#include &quot;DFrobot_bmp.h&quot;
#include &quot;DFrobot_char.h&quot;

unsigned char fuse[1024];
void setup()
{

  LCDA.initDriverPin(2,7,10); 

  LCDA.Initialise(); // INIT SCREEN  
  pinMode(11, OUTPUT); 
  digitalWrite(11,HIGH);  
  
}
unsigned char* fuse3(unsigned char* a ,unsigned char* b,unsigned char* c){
 unsigned char* fused =(unsigned char*)malloc(sizeof(char)*1024);

  int i=0;
  int ac=0;//a counter 
  int bc=0; //b counter 
  int cc=0;//c counter 

  for(int n=0;n&lt;64;n++){
    for(int k=0;k&lt;5;k++){
      fused[i]=a[ac];
      ac++;
       i++;
    }
        for(int k=0;k&lt;5;k++){
      fused[i]=b[bc];
      bc++;
       i++;
    }
        for(int k=0;k&lt;5;k++){
      fused[i]=c[cc];
      cc++;
       i++;
    }
    fused[i]=0x00;
    i++;
  }
  return fused;
}
unsigned char* getMatch(int input){

  input = input &amp; 0x000f;

  switch (input){
   case 0: return g0;
   case 1: return g1;
   case 2: return g2;
   case 3: return g3;
   case 4: return g4;
   case 5: return g5;
   case 6: return g6;
   case 7: return g7;
   case 8: return g8;
   case 9: return g9;
   case 10: return plus;
   case 11: return minus;
   case 12: return times;
   case 13: return g1;
   case 14: return g1;
   case 15: return g1;
   default: return g1;
  }
}
void displayfuse(int number){
 LCDA.CLEAR();
   delay(100);

 
 int mask1 = 0xF000;
 int mask2 = 0x0F00;
 int mask3 = 0x00F0;

 int firstnumber = number&amp;mask1&gt;&gt;12;
 int operation = number&amp;mask2&gt;&gt;8;
 int secondnumber= number&amp;mask3&gt;&gt;4;
  
  LCDA.DrawFullScreen(fuse3(getMatch(firstnumber),getMatch(operation),getMatch(secondnumber)));
  delay(5000);
}
void loop(){
  displayfuse(0x1234);
  delay(1000)
}
</code></pre>
<p>This causes the led to not turn on but moving the lines where I make pin 11 output and high one up (beyond the  <code>LCDA.Initialise(); // INIT SCREEN</code> ) then the led will turn on. It can also be turned on by commenting out the       <code>LCDA.DrawFullScreen(fuse3(getMatch(firstnumber),getMatch(operation),getMatch(secondnumber)));</code> line.
Magic is happening...</p>
 5168: <p>The 'dark magic' is going to be your program rebooting every time it gets to that line. I would imagine (this isn't a library I know) that you're exceeding an array bound &amp; generating a 'segfault', although it could be that you light up your LCD array &amp; the power draw causes a reboot..
Because the LED flash is at the start of setup, it executes quickly, so generating the appearance of continual flashing when  it re-enters repeatedly.
Your code is going to assign g1[0] when the line in question executes - is g1[] defined to point somewhere valid?</p>
