Controlling an actuator based on Sensor Data

I am working on my diploma final year project on IOT based home automation… The problem is i am not understanding how to controll an actuator like servo motor based on the sensor data like DHT11 sensor… Please someone help me with the code… By the way i am using Nodemcu… and Arduino ide programming…Help me with any other similar code… please