Light Sculpture Architecture: onTime and stepSize
Home
Current Objective: Updating onTime and stepSize
Requirements
Ensure
you
understand
each step before
moving on.
Write code
for each step as you go.
Cleanly format
your code.
Test
your code at the end of each page.
Updating onTime and stepSize
Add
the following at the end of the
Fading Functions
:
Open
the definition of
getOnTimeUsingFraction
with the
statement
Assign
fractionOn
to be the
gammaCorrected fractionOn
with the
statement
Declare
a
const int onTime
and
assign
it to be the product of
fractionOn
and
pwmPeriod
with the
statement
Return
onTime
with the
statement
Open
the definition of
updateStepSize
with the
statement
Declare
a
float knobRatio
to be the ratio of
knobValue
to
nigthLightMinValue
with the
statement
Invert
the
knobRatio
with the
statement
Declare
a
const float numberOfSteps
and
assign
it to be the product of
duration
and
knobRatio
divided by the
msPerStep
with the
statement
Assign
fadingStepSize
to be the reciprocal of
numberOfSteps
with the
statement
Make sure your code compiles before continuing!
Back
Next Page