Light Sculpture Architecture: onTime and stepSize

Home

Current Objective: Updating onTime and stepSize

Requirements

  1. Ensure you understand each step before moving on.
  2. Write code for each step as you go.
  3. Cleanly format your code.
  4. Test your code at the end of each page.

Updating onTime and stepSize

Add the following at the end of the Fading Functions:

  1. Open the definition of getOnTimeUsingFraction with the statement
    1. Assign fractionOn to be the gammaCorrected fractionOn with the statement
    2. Declare a const int onTime and assign it to be the product of fractionOn and pwmPeriod with the statement
    3. Return onTime with the statement
  2. Open the definition of updateStepSize with the statement
    1. Declare a float knobRatio to be the ratio of knobValue to nigthLightMinValue with the statement
    2. Invert the knobRatio with the statement
    3. Declare a const float numberOfSteps and assign it to be the product of duration and knobRatio divided by the msPerStep with the statement
    4. Assign fadingStepSize to be the reciprocal of numberOfSteps with the statement

Make sure your code compiles before continuing!

Back Next Page