Current Objective: Create the Light Sculpture Modes
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 Modes
- Create a new sketch titled "Your_Initials_NightLightMode"
- Copy & Paste your PWM code into the new sketch.
- Save it as Your_Initials_NightLightMode
- Update your code with the following:
/* Light Sculpture Night Light Mode - 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);
// Helper Functions
void turnOnArray(const byte arrayName[], const byte arrayLength);
void turnOffArray(const byte arrayName[], const byte arrayLength);
void turnOnAll();
void turnOffAll();
Global Variables (Nouns)
To enumerate is to list a number of related things. For instance: enum Flavors {strawberry, vanilla, chocolate};
would lead to some tasty Neapolitan.
You can also declare variables based on the enumerated type. For instance: Flavors bestFlavor = chocolate;
Boolean variables can only be true or false. For instance: bool codingIsFun = true;