Current Objective: Create the Light Sculpture Fade
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.
Creating the Fade
- Create a new sketch titled "Your_Initials_LightSculpture"
- Copy & Paste your Night Light Mode code into the new sketch.
- Save it as Your_Initials_LightSculpture
- Update your code with the following:
/* Light Sculpture Architecture - Written by Kyle Stewart - Updated 40217*/
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// Function Declarations (Verbs) //
// //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Mode Selection
void updateMode();
void updateOffSwitch();
void runLightShow();
void runNightLight();
// Knob Functions
void pwmUsingKnob();
int getOnTimeUsingKnob();
void updateKnobValue();
float gammaCorrect(float ratio);
// Display Functions
void ebbAndFlow(int fadeTime);
void blinkInPairs(int fadeTime);
// Fading Functions
void fadeUp(const byte pin, int duration);
void fadeDown(const byte pin, int duration);
void fadeUpArray(const byte arrayName[], const byte arrayLength, int duration);
void fadeDownArray(const byte arrayName[], const byte arrayLength, int duration);
int getOnTimeUsingFraction(float fractionOn);
void updateStepSize(int duration);
// Helper Functions
void turnOnArray(const byte arrayName[], const byte arrayLength);
void turnOffArray(const byte arrayName[], const byte arrayLength);
void turnOnAll();
void turnOffAll();
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
// Global LED Array Declarations (Lists) //
// //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Stewart's note: you can change or delete these samples but they are referenced in the instructions
const byte sampleAcrossArray[] = {11, 10, 9, 8, 7, 3, 2, 4, 5, 6, 12, 13, 14, 15};
const byte sampleLeftArray[] = {11, 10, 9, 8, 7, 3, 2 };
const byte sampleRightArray[] = {15, 14, 13, 12, 6, 5, 4};
Global Variables (Nouns)
Next Page