My program is freezing in "Compiling sketch..."

Hello everyone,

I'm having issues compiling my program. I'm working towards a program that flashes LEDs on a wind turbine blade to spell messages out as the turbine spins. At this point, I thought I had everything done except for figuring out how to determine the velocity of the turbine and use that for timing the message, but then I changed my code around a bit and now the thing gets stuck compiling. I'll paste my code in and then explain what I changed.

const int sensorPin = A0;
const float baselineTemp = 23.5;
int enter_else = 0;

void setup() 
{
  Serial.begin(9600);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(1, INPUT);
}

void loop() 
{
  //Dimensions in inches, time in milliseconds
  
  int i, sensorVal, switch_state;
  float innermost_LED_radius, LED_diameter, LEDTimer, pi, rev_time, temperature, voltage;
  String printout;
  
  printout = "HELLO WORLD!";
  innermost_LED_radius = 3;
  LED_diameter = 0.1875;
  pi = 3.14159265358979;
  rev_time = 32.5 * 1000;
  
  LEDTimer = rev_time / (innermost_LED_radius * 2 * pi / LED_diameter);
  
  Serial.print("# of usable LED lines: ");
  Serial.print(innermost_LED_radius * 2 * pi / LED_diameter);
  Serial.print(", LEDTimer: ");
  Serial.println(LEDTimer);
  
  switch_state = digitalRead(1);
  
  if(switch_state == 0/* || (enter_else && switch_state != 0)*/)
  {
    set_all_to_low();
    enter_else = 0;
  }
  else
  {
    enter_else = 1;
    
    for(i = 0; i <= printout.length(); i++)
    {
       print_character(printout.charAt(i), LEDTimer);
       
       //Cout set_all_to_low();
       
       //Cout delay(1000);
    }
  }
}

void set_all_to_low(void)
{
  int j;
  
  for (j = 2; j <= 8; j++)
  {
    digitalWrite(j, LOW);
  }
}

void print_character(char c, double LEDTimer)
{
  switch(c)
  {
    case 'A':
    {
      3_to_8(LEDTimer);
      2_5(LEDTimer);
      2_5(LEDTimer);
      2_5(LEDTimer);
      3_to_8(LEDTimer);
      
      break;
    }
    
    ////***************************Cases B through Y cut out because my post was over 9000 characters**********
    
    case 'Z':
    {
      2_7_8(LEDTimer);
      2_6(LEDTimer);
      2_5(LEDTimer);
      2_4(LEDTimer);
      2_3_8(LEDTimer);
      
      break;
    }
    
    case '1':
    {
      4_8(LEDTimer);
      3_8(LEDTimer);
      2_to_8(LEDTimer);
      8(LEDTimer);
      8(LEDTimer);
      
      break;
    }
    
    ////***********************Cases 2-8 cut out to make post smaller****************************
    
    case '9':
    {
      3_4_7(LEDTimer);
      2_5_8(LEDTimer);
      2_5_8(LEDTimer);
      2_5_8(LEDTimer);
      3_4_6_7(LEDTimer);
      
      break;
    }
    
    case ' ':
    {
      nothing(LEDTimer);
      nothing(LEDTimer);
      nothing(LEDTimer);
      nothing(LEDTimer);
      nothing(LEDTimer);
      
      break;
    }
    
    case '.':
    {
      nothing(LEDTimer);
      8(LEDTimer);
      nothing(LEDTimer);
      nothing(LEDTimer);
      nothing(LEDTimer);
      
      break;
    }
    
    case ':':
    {
      nothing(LEDTimer);
      4_6(LEDTimer);
      nothing(LEDTimer);
      nothing(LEDTimer);
      nothing(LEDTimer);
      
      break;
    }
    
    case '!':
    {
      nothing(LEDTimer);
      2_to_6_8(LEDTimer);
      nothing(LEDTimer);
      nothing(LEDTimer);
      nothing(LEDTimer);
      
      break;
    }
    
    case '?':
    {
      3_4(LEDTimer);
      2(LEDTimer);
      2_6_8(LEDTimer);
      2_5(LEDTimer);
      3_4(LEDTimer);
      
      break;
    }
  }
}

void 2(float LEDTimer)
{
  digitalWrite(2, HIGH);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  
  delay(LEDTimer);
}

void 2_3(float LEDTimer)
{
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  
  delay(LEDTimer);
}

void 2_3_7_8(float LEDTimer)
{
  digitalWrite(2, HIGH);
  digitalWrite(3, HIGH);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  
  delay(LEDTimer);
}

////************************Most functions cut out of this group too, again because of being >9000*************

void 7_8(float LEDTimer)
{
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, HIGH);
  digitalWrite(8, HIGH);
  
  delay(LEDTimer);
}

void 8(float LEDTimer)
{
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  digitalWrite(8, HIGH);
  
  delay(LEDTimer);
}

void nothing(float LEDTimer)
{
  digitalWrite(2, LOW);
  digitalWrite(3, LOW);
  digitalWrite(4, LOW);
  digitalWrite(5, LOW);
  digitalWrite(6, LOW);
  digitalWrite(7, LOW);
  digitalWrite(8, LOW);
  
  delay(LEDTimer);
}

So basically, right now I have a function called print_character that uses a switch-case statement to print a character. Each case speels out a letter by making a series of function calls to different functions that just use digitalWrite to turn on or off select LEDs. Yesterday, I was just making the digitalWrite calls directly inside of print_character and skipping the extra step of helper functions, and it was compiling/running just fine. Then, this morning, I went from running five LEDs for four cycles per letter to 7 LEDs for five cycles per letter and added in the helper functions. Now, it just freezes at "Compiling sketch..." when I try to compile and upload to the board. Any idea what's going on?

I ran the trimmed-down coe that i posted here to see what would happen, and I got a lot of error messages yelling at me for using numbers to begin function names... I'll fix that and report back

Fixed that, now it compiles... yaay!

Serial.begin(9600);
switch_state = digitalRead(1);

no, no, NO! Bad Jooseppi_Luna, pin 1 is used by serial TX, it is not an input and you should not be using it!

PS: functions/variables CANNOT begin with numbers.

PPS: when naming variables/functions, use camel case (not required, but recommended). First word starts as lowercase, every word after that starts with uppercase. EXAMPLE: boolean thisIsProperCamelCase = true;

PPPS: Don't use Strings! You can fragment the heap and the uProcessor thinks it is out of ram. Use character arrays.

char myCharArray[] = "HELLO WORLD!";

Ps991:

Serial.begin(9600);
switch_state = digitalRead(1);

no, no, NO! Bad Jooseppi_Luna, pin 1 is used by serial TX, it is not an input and you should not be using it!

PS: functions/variables CANNOT begin with numbers.

PPS: when naming variables/functions, use camel case (not required, but recommended). First word starts as lowercase, every word after that starts with uppercase. EXAMPLE: boolean thisIsProperCamelCase = true;

PPPS: Don't use strings! You can fragment the heap and the uProcessor thinks it is out of ram. Use character arrays.

char myCharArray[] = "HELLO WORLD!";

Uh-oh! Thank you! I'll switch from pin 1 to pin 9...

Yeah, I forgot that I can't start identifier names with numbers :o

I know that camel case is what I should use, but I've done a lot of C programming, and I got used to writing my variables like_this, and it seemed like the quickest way to fix my oopsie. I was calling the incorrectly named functions over 200 times. I also find this_way easier to read than thisWay.

Thanks for the tip on strings... I'll use a character array instead.

-Jooseppi

PPPS: Don't use strings!

No. No. No.

Do use strings. Do NOT use Strings!

PaulS:
No. No. No.

Do use strings. Do NOT use Strings!

Is there a string type AND a String type? I'm confused.

Is there a string type AND a String type? I'm confused.

A string is a NULL terminated array of chars. There are a number of functions that deal with strings.

A String is a class that dynamically allocates space to hold the characters (which it actually stores in a string) with a number of methods that replicate the string functions.

Well...Pauls is not wrong...