Ramping Down the variable in Arduino IDE with the help of millis()??......

Hi John, thanks for your feedback.

In Graph "No1" the X-Axis scale is wrong, Please see the updated Graph "No1". The Setpoint/programmed Voltage and what it does comes from the function we discussed earlier here "Ramp_Hold_Dump()" function. Also the "PID/Output" blue curve is the PID output, calculated and plotted but in arbitrary units, because I don't know what kind of measurement unit it has. So I wrote on graph a.u.= arbitrary units.

double setpoint_value_Ramp_Hold_Dump()
            {
              static unsigned long start_millis = 0;
              unsigned long current_millis;
              const unsigned long hold_1 = 1;
              current_millis = millis();
                if (current_millis - start_millis >= hold_1)
                  {
                    start_millis += hold_1;
                      if(RampingUp)
                       {
                        setpoint += 0.01;
                        if (setpoint > 3.279)
                          {
                           setpoint = 3.279;
                           RampingUp = false;
                          }
                       }
                        else  // not RampingUp
                         {
                          setpoint -= 0.01;
                           if(setpoint < 0.0)
                            {
                             setpoint = 0.0;
                             RampingUp = true;
                            }
                         }
                   }
               }

With Respect to "Graph No3"

The X axis runs from 5000 till 7000 and is in milliseconds, it is results of the millis() function printed in serial and always starts from 5000, no idea why.

The data comes from the Due, which reads out the analog signal from a sensor, then compares with the setpoint, which in our case is the setpoint_value_Ramp_Hold_Dump() function, and then calculates the amount of voltage it needs to output on both DAC's, which are connected to sensor as super tiny heaters.