Current Objective: Creating Sample Displays
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 Sample Displays
Copy the following to test your fading:
// these are samples and should be modified or deleted for your show
void runLightShow() {
int fastTime = 300;
int midTime = 800;
int slowTime = 1500;
int repeatCount = 5;
ebbAndFlow(fastTime);
blinkInPairs(slowTime, repeatCount);
}
void ebbAndFlow(int fadeTime) {
for (byte index = 0; index < sizeof(sampleAcrossArray); index++) {
byte pin = sampleAcrossArray[index];
fadeUp(pin, fadeTime);
}
for (int index = sizeof(sampleAcrossArray) - 1; index >= 0; index--) {
byte pin = sampleAcrossArray[index];
fadeDown(pin, fadeTime);
}
}
void blinkInPairs(int fadeTime, int repeatCount) {
for (int count = 0; count < repeatCount; count++) {
for (byte index = 0; index < sizeof(sampleLeftArray); index++) {
byte ledPair[] = {sampleLeftArray[index], sampleRightArray[index]};
fadeUpArray(ledPair, sizeof(ledPair), fadeTime);
}
for (int index = sizeof(sampleLeftArray) - 1; index >= 0; index--) {
byte ledPair[] = {sampleLeftArray[index], sampleRightArray[index]};
fadeDownArray(ledPair, sizeof(ledPair), fadeTime);
}
fadeTime /= 2; // double the speed for the next run
}
}
Make Your Light Show
- Create your show using arrays and functions.
- Include at least five "acts" or displays for your show.
- Test that the knob controls your show speed.
- Test that your show looks good at various speeds.