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)

  1. Create a controls object called cset
  2. 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;

  1. 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;

  1. Return the cset object.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!