Embedded C program in a microcontroller (AVR ATmega8): manage the speed of a fan high or low depending on temperature and switch the fan ON or OFF during night 10 pm to morning 11 am
Asked in the technical stage at Rockwell Collins, now Collins Aerospace, embedded technical interview.
Implement the equivalent decision logic as fan_control(temperature, hour, high_threshold). hour is an integer from 0 through 23. Return a dictionary with power, either "ON" or "OFF", and speed, either "LOW" or "HIGH". The fan is OFF from 22:00 through 10:59 and ON from 11:00 through 21:59. When ON, use HIGH if temperature is at least high_threshold; otherwise use LOW.
def fan_control(temperature, hour, high_threshold):