want code to input value from keypad and using that value control a fan

I want to write a code to manually input a value for temperature through a keypad and use that value to control a fan on for 5min.


if I can input a value 30 (as temperature trigger value) through the keypad,
I want to use that value in the following code:

// temp : temperature value from temperature sensor
//triggerTEMP : value from keypad to set trigger temperature

if(temp > triggerTEMP)
digitalWrite (relayFAN, HIGH);
digitalWrite (relayFAN, LOW);

Yes, you can do that.

Use your favorite search engine and the search phrase "arduino keypad input" for lots of examples.