Breathing LED controlled by temperature sensor (NEED HELP!!)

PaulRB:
and what transistor?

Transistor?

kovil:
How do I take a pause after sampling and analogWriting at the end of the loop?

#include <math.h>

const int transistorPin = 9;
int tempPin = 0;
int tempReading;
int x;
void setup()
{
  pinMode(9, OUTPUT); 
  Serial.begin(9600); 
}

void loop()
{
  tempReading=analogRead(tempPin);//temperature reading
  x=map(tempReading,150,170,1,5);//map the reading to change the frequency
  Serial.println(x);
  float val = (exp(sin(millis()/1500.0*x*PI)) - 0.36787944)*108.0;//the function of breathing led
  Serial.println(val);
  analogWrite(transistorPin, val);
  delay(500);  //  <<<< a pause
}

Stll, though, what is the "breathing" effect here?