While loop and Do/while loop trouble

Hello i am working on a project containing flow meters and used this article (http://forum.arduino.cc/index.php/topic,8548.0.html)
to read the flow rate and then i just added a counter to see how much has flowed through, I am trying to connect a solenoid to the same line as a counter and have the solenoid open and when a certain amount of liters flow through the flow meter i want the solenoid to shut off. I have the semi working code here

// reading liquid flow rate using Seeeduino and Water Flow Sensor from Seeedstudio.com
// Code adapted by Charles Gantt from PC Fan RPM code written by Crenn @thebestcasescenario.com
// http:/themakersworkbench.com http://thebestcasescenario.com http://seeedstudio.com

volatile int NbTopsFan; //measuring the rising edges of the signal
float Calc;                              
int hallsensor = 2;    //The pin location of the sensor
float Total = 0;
float totalTwo = 0;
int redLed = 7;
int greenLed = 8;
boolean check = true;
boolean next = true;

void rpm ()     //This is the function that the interupt calls
{
  NbTopsFan++;  //This function measures the rising and falling edge of the
}
// The setup() method runs once, when the sketch starts
void setup() //
{
  pinMode(hallsensor, INPUT); //initializes digital pin 2 as an input
  digitalWrite(hallsensor, HIGH);
  Serial.begin(9600); //This is the setup function where the serial port is
  attachInterrupt(0, rpm, RISING); //and the interrupt is attached
  pinMode(redLed, OUTPUT);
  pinMode(greenLed, OUTPUT);
}
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop ()    
{
  int key = Serial.read();
  Serial.print("Test");
  delay(2000);
  if(key == 'G'){
    lightCheck();
  }
  if(key == 'H'){
    nextBlock();
  }
}


void lightCheck(){
  while(check){
    digitalWrite(redLed, HIGH);
    NbTopsFan = 0;      //Set NbTops to 0 ready for calculations
    sei();            //Enables interrupts
    delay (1000);      //Wait 1 second
    cli();            //Disable interrupts
    Calc = (NbTopsFan * 60 / 7.5); //(Pulse frequency x 60) / 7.5Q, = flow rate
    Total += Calc;
    Serial.print (Calc, DEC); //Prints the number calculated above
    Serial.print (" Liters/Hour\r\n"); //Prints "L/hour" and returns a  new line
    Serial.print (Total, DEC);
    Serial.print ( "Total Liters\r\n");
    if(Total >= 100){
      check = false;
      digitalWrite(redLed, LOW);
    }
  }
  do{
    digitalWrite(greenLed, HIGH);
    NbTopsFan = 0;      //Set NbTops to 0 ready for calculations
    sei();            //Enables interrupts
    delay (1000);      //Wait 1 second
    cli();            //Disable interrupts
    Calc = (NbTopsFan * 60 / 7.5); //(Pulse frequency x 60) / 7.5Q, = flow rate
    totalTwo += Calc;
    Serial.print (Calc, DEC); //Prints the number calculated above
    Serial.print (" Liters/Hour\r\n"); //Prints "L/hour" and returns a  new line
    Serial.print (totalTwo, DEC);
    Serial.print ( "Total Liters\r\n");
    if(totalTwo >= 200){
      next = false;
      digitalWrite(greenLed, LOW);
    }
  }
  while(next);

  nextBlock();

}

void nextBlock(){
  Serial.print("Hello");
}

The only problem i am having is it is not going to the nextBlock() part of the code and back to void loop. as soon as the boolean next becomes false it turns off greenLed but it does not continue to nextBlock() and back to void loop. My question is why i thought as soon as the while loop became false it went to the next part of code, i also tried using just a while loop instead of a do/while loop and still the same outcome, i also used a break; statement instead of declaring next and check false that also yielded the same result. For some reason after the while statements become false it wont go onto the next piece of code calling nextBlock() and eventually going back to loop(); What am i doing wrong?

a while loop executes zero or more times
a do while loop executes one or more times.

in loop() there is the first problem. you read from serial without checking if there is something available
the delay(2000) is not needed.

void loop ()    
{
  int key = '';
  if (Serial.available() > 0)
  {
    key = Serial.read();
    Serial.print("Test");
    if (key == 'G')
    {
      lightCheck();
    }
    if (key == 'H')
    {
      nextBlock();
    }
  }
}

remove all delays
detect every puls with a interupt.
then use millis() for timing and flow use the counter for volume

Thank you for the fast replies and using the Serial.available > 0 was a fix for not having to use the delay (i just had it in there so it printed "Test" every two seconds while in the main loop.) But changing that did not fix the problem it still turned on the redLed and when the counter got above the limit it changed check to false and turned off the redLed then it turned on the greenLed and when that was above the limit it changed next to false and turned off the greenLed but then it is like the code is hanging there it doesn't continue back to the main loop it just sits there idling and doesn't do anything after that.

and when that was above the limit it changed next to false and turned off the greenLed but then it is like the code is hanging there it doesn't continue back to the main loop it just sits there idling and doesn't do anything after that.

    NbTopsFan = 0;      //Set NbTops to 0 ready for calculations
    sei();            //Enables interrupts
    delay (1000);      //Wait 1 second
    cli();            //Disable interrupts
    Calc = (NbTopsFan * 60 / 7.5); //(Pulse frequency x 60) / 7.5Q, = flow rate
    totalTwo += Calc;
    Serial.print (Calc, DEC); //Prints the number calculated above
    Serial.print (" Liters/Hour\r\n"); //Prints "L/hour" and returns a  new line
    Serial.print (totalTwo, DEC);
    Serial.print ( "Total Liters\r\n");

Doing serial output with interrupts disabled is a recipe for disaster. Enabling interrupts only during a delay() is the WRONG way to read pulses for a fixed period of time.

Rethink your entire approach.

Maybe this approach is not the best way for the way i want to use it, but i used the write up on flow meters on this page(http://forum.arduino.cc/index.php/topic,8548.0.html) and I used that exact code and it has worked great up to this point where I am trying to switch a led off when it counts so many liters have passed. I cant use the main loop to count the pulses so it has to be in a separate function but it seems when i put it in a different functions it doesn’t go back to the main loop at all. I dont know another approach where i could count the pulses and compare them in a while loop in a separate function such as lightCheck(). If you know of another approach i would be grateful if you could demonstrate so i could learn.
Thank you