Fade an LED without Delay

As the title says I am trying to fade an LED without Delay as I want to be able to count the number of presses of a switch. Is that possible? My codes is here:

//Constant Inputs:
const int LDRIn = A0; // Analog input pin for LDR
const int ThermIn = A1; // Analog input pin for Thermistor
const int TiltIn = A2; //Analog input pin for Tilt Switch

//Constant Outputs:
const int LEDBarOut = 6; // Analog output pin for LED Bar
const int LEDgOut = 9; // Analog output pin for Red side of Bi-Colour LED
const int LEDrOut = 10; // Analog output pin for Green side of Bi-Colour LED

//Variable Inputs:
int LDRValue = 0; // value read from the LDR
int ThermValue = 0; // value read from the Thermistor
int TiltValue = 0; // value read from the Tilt Switch

//Variable Outputs:
int LEDrValue = 0; // value output to the Bi Colour LED
int LEDgValue = 0; // value output to the Bi Colour LED

// include the library code for LCD display:
#include <LiquidCrystal.h>

// set the Pins for the LCD Display:
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
// initialize serial communications at 9600 bps:
Serial.begin(9600);
}

void loop() {
//LDR → LED Bar
LDRValue = analogRead(LDRIn); //Gets value from LDR
if (LDRValue <= 150) //less than

{
for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5)
{
// sets the value (range from 0 to 255):
analogWrite(LEDBarOut, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}

// fade out from max to min in increments of 5 points:
for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5)
{
// sets the value (range from 0 to 255):
analogWrite(LEDBarOut, fadeValue);
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
}
else
{
digitalWrite(LEDBarOut, LOW);
}

//Thermistor → Bi Colour LED
ThermValue = analogRead(ThermIn); //Gets value from Thermistor
LEDrValue = map(ThermValue, 400, 600, 0, 255); //Maps value to Red side of LED
LEDgValue = map(ThermValue, 400, 600, 255, 0); //Maps value to Green side of LED

analogWrite(LEDgOut, LEDgValue); //Writes value to Green LED
analogWrite(LEDrOut, LEDrValue); //Writes value to Red LED

delay(10);

//Tilt Switch

if (TiltIn == HIGH);
{
TiltValue++;
}

//LCD Display

//LDR Monitoring:
Serial.print(" LDR = " );
Serial.println(LDRValue);

//Thermistor Monitoring:
Serial.print(" Thermistor = " );
Serial.print(ThermValue);
Serial.print(" Bi G LED = “);
Serial.print(LEDgValue);
Serial.print(” Bi R LED = ");
Serial.println(LEDrValue);

//Tilt Switch Monitoring:
Serial.print(" Steps = ");
Serial.println(TiltValue);

// wait 10 milliseconds before the next loop
// for the analog-to-digital converter to settle
// after the last reading:
delay(10);

}

Nevermind I worked it out! Just needed to search a little more of this site! My code is now:

//Constant Inputs:
const int LDRIn = A0; // Analog input pin for LDR
const int ThermIn = A1; // Analog input pin for Thermistor
const int TiltIn = A2; //Analog input pin for Tilt Switch

//Constant Outputs:
const int LEDBarOut = 6; // Analog output pin for LED Bar
const int LEDgOut = 9; // Analog output pin for Red side of Bi-Colour LED
const int LEDrOut = 10; // Analog output pin for Green side of Bi-Colour LED

//Variable Inputs:
int LDRValue = 0; // value read from the LDR
int ThermValue = 0; // value read from the Thermistor
int TiltValue = 0; // value read from the Tilt Switch

//Variable Outputs:
int LEDrValue = 0; // value output to the Bi Colour LED
int LEDgValue = 0; // value output to the Bi Colour LED

//Fade Variables
int flashValue; //controls the Value of the LED Bar Fade
int flash = 2500; //Sets the length of the Fade
long time=0; //Sets time to 0

// include the library code for LCD display:
#include <LiquidCrystal.h>

// set the Pins for the LCD Display:
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
// initialize serial communications at 9600 bps for monitoring
Serial.begin(9600);
}

void loop() {
//LDR → LED Bar
LDRValue = analogRead(LDRIn); //Gets value from LDR
if (LDRValue <= 150) //less than
{
time = millis();
flashValue = 128+127cos(2PI/flash*time);
analogWrite(LEDBarOut, flashValue); // sets the flashValue (range from 0 to 255)
}
else
{
digitalWrite(LEDBarOut, LOW);
}

//Thermistor → Bi Colour LED
ThermValue = analogRead(ThermIn); //Gets value from Thermistor
LEDrValue = map(ThermValue, 400, 600, 0, 255); //Maps value to Red side of LED
LEDgValue = map(ThermValue, 400, 600, 255, 0); //Maps value to Green side of LED

analogWrite(LEDgOut, LEDgValue); //Writes value to Green LED
analogWrite(LEDrOut, LEDrValue); //Writes value to Red LED

delay(10);

//Tilt Switch

if (TiltIn == HIGH);
{
TiltValue++;
}

//LCD Display

//LDR Monitoring:
Serial.print(" LDR = " );
Serial.println(LDRValue);

//Thermistor Monitoring:
Serial.print(" Thermistor = " );
Serial.print(ThermValue);
Serial.print(" Bi G LED = “);
Serial.print(LEDgValue);
Serial.print(” Bi R LED = ");
Serial.println(LEDrValue);

//Tilt Switch Monitoring:
Serial.print(" Steps = ");
Serial.println(TiltValue);

//Above code after “//LDR Monitoring:” is only to monitor input and output values for fault testing.

delay(10); //Delays 10 milliseconds before next loop

}

Nevermind I worked it out!

So remember the next time you post code, select it all and hit the # icon.