DIMMER Project

Hi I have a dimmer to design in certain way. I know basic and done some sketch.
if ( MODE == 2) { // DIMM
if (tempc < settemp-2) { //100%
OCR1A = 50;}

if ((tempc >= settemp-2)&&(tempc < settemp-1)) { //75%
for( i = 50; i <= 110; i++) {
OCR1A = i; //set the compare register brightness desired.
delay(5);
}
}
if ((tempc >= settemp-1)&&(tempc < settemp)) { //50%
for( i = 110; i <= 220; i++) {
OCR1A = i; //set the compare register brightness desired.
delay(5);
}
}
if (tempc >= settemp) { //OFF
for( i = 220; i <= 483; i++) {
OCR1A = i; //set the compare register brightness desired.
delay(5);
}

}

That should work like:
if tempc is below 2deg from settemp then light should dimm to certain value (75%) just once! and stays
if tempc is below 1 deg from settemp then light should dimm to 50% brightness just once! and stays
if tempc is = settemp light is OFF
and from that stage when tempc is going to low then should dimm from off to 50% just once
then when it is lower then from 50-75% and when is lower then 2deg fully ON.
any help?

I guess this is school work. What do you have to produce ? A complete working sketch including a hardware implementation of the dimmer and temperature sensor or just some code fragments ?
Since the OCR1A register appears to be central to your solution, you should look at the data sheet for the ATAMEGA328P (the chip form for example, the Arduino Uno). to understand the effect of modifying this variable.