Allows you to control LED flash speed and brightness by using the analog slider switch & the potentiometer. furthermore, the 4 push buttons each have their own flash patterns.

Dependencies:   mbed tsi_sensor

Files at this revision

API Documentation at this revision

Comitter:
s_booth9
Date:
Mon Feb 23 03:52:53 2015 +0000
Parent:
0:2cf594207c1a
Commit message:
revision of previous light show code, now with added header and use of else if statements instead of simply if statements.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 2cf594207c1a -r d346428e30a2 main.cpp
--- a/main.cpp	Mon Feb 23 02:01:26 2015 +0000
+++ b/main.cpp	Mon Feb 23 03:52:53 2015 +0000
@@ -1,3 +1,9 @@
+//Program: light show Booth
+//Author: Spencer Booth
+//Date: 22 Feb 2015
+//Description: this program will allow the user to change the LED
+//             flash pattern as well as flash speed and brightness.
+
 //preproccesor statements
 #include "mbed.h"
 #include "tsi_sensor.h"
@@ -15,15 +21,15 @@
 PwmOut Green(LED_GREEN);        // PWM outputs tied to MBED LEDs
 PwmOut Red(LED_RED);            
 PwmOut Blue(LED_BLUE);
-AnalogIn Potentiometer(A0);
+AnalogIn Potentiometer(A0); // LED brightness controller
 
-TSIAnalogSlider tsi(PTB16,PTB17,50);
+TSIAnalogSlider tsi(PTB16,PTB17,50);// LED flash speed controller
 
 int main() 
 {
     while(1)
     {
-    if(Switch1 == 0)
+    if(Switch1 == 0) // flash pattern for when switch 1 is pressed
         {
         ProtoBoardRed = Potentiometer;
         ProtoBoardGreen = Potentiometer;
@@ -35,7 +41,7 @@
         ProtoBoardYellow = 0;
         wait(1 - tsi.readPercentage() );
         }
-    if(Switch2 == 0)
+    else if(Switch2 == 0) // flash pattern for when switch 2 is pressed
         {
         ProtoBoardRed = Potentiometer;
         ProtoBoardGreen = Potentiometer;
@@ -47,7 +53,7 @@
         ProtoBoardYellow = Potentiometer;   
         wait(1 - tsi.readPercentage() );        
         }
-    if(Switch3 == 0)
+    else if(Switch3 == 0)// flash pattern for when switch 3 is pressed
         {
         ProtoBoardRed = Potentiometer;
         ProtoBoardGreen = 0;
@@ -64,7 +70,7 @@
         ProtoBoardYellow = Potentiometer;   
         wait(1 - tsi.readPercentage() );
         }
-    if(Switch4 == 0)
+    else if(Switch4 == 0)// flash pattern for when switch 4 is pressed(combination of the last 3 switches patterns)
         {
         Red = 1;
         
@@ -114,7 +120,7 @@
         Blue = 0;
         Green = 0;  
         }
-    else
+    else    // if no button is pressed, no lights will be on.
         {
         ProtoBoardRed = 0;
         ProtoBoardGreen = 0;