Question: How can I create this piece of code? We pass the setpoints and controls structures to the GhSetControls function. This function does the logic for
How can I create this piece of code?
We pass the setpoints and controls structures to the GhSetControls function. This function does the logic for controlling a heater and humidifier in response to target data and the current readings.
control_s GhSetControls(setpoint_s target, reading_s rdata)
- Create a controls object called cset
- If the rdata temperature is less than the target temperature
if(rdata.temperature
assign ON to the cset heater variable, otherwise assign it an OFF;
- If the rdata humidity is less than the target humidity
if(rdata.humidity< SHUMID)
assign ON to the cset humidifier variable, otherwise assign it an OFF;
- Return the cset object.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
