William Etter / Mbed 2 deprecated LEDTable

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LEDTable.h Source File

LEDTable.h

00001 
00002 
00003 
00004 /* ************************************************************ */
00005 /* ***************** VARIABLE DEFINITIONS ********************* */
00006 /* ************************************************************ */
00007 /* *********************** */
00008 // Table Variables
00009 /* *********************** */
00010 char ledtable [16][32];         // Table Array, values range between 0 and 60
00011 float displayDelay = 0.005;     // Table Display Delay Amount
00012 Timer tabletimer;               // Table Timer
00013 int tabletimeseconds;           // Table Time in Seconds
00014 int table_change_time = 10; // Time in seconds to change
00015 int current_function = 0;      // Current Table Function
00016 int next_function = 0;         // Next Table Function
00017 
00018 
00019 
00020 Serial pc(USBTX, USBRX); // tx, rx
00021 
00022 
00023 /* *********************** */
00024 // FUNCTION LIST
00025 /* *********************** */
00026 // -1 = Clear Table Function
00027 char function_enable[5] = {1,1,1,1,1};
00028 // 0    = Matrix Function
00029 // 1    = Wave Function
00030 // 2    = Waves Function
00031 // 3    = Tunnel Function
00032 // 4    = Rain Function
00033 
00034 /* *********************** */
00035 // FUNCTION LIST
00036 /* *********************** */
00037 char clear_function_enable[1] = {1};
00038 // -1 = Clear Table Function
00039 // 0    = Dissolve Clear Function
00040 int dissolve_time = 300;
00041 
00042 /* *********************** */
00043 // Misc Variables
00044 /* *********************** */
00045 double pi = 3.14159;            // Pi Definition
00046 
00047 /* *********************** */
00048 // Matrix Function Control Variables
00049 /* *********************** */
00050 int matrix_update_time = 50;    // How often to update the entire matrix function
00051 int leader_time_diff = 3000;    // How often to try and make a new leader
00052 int leader_probabilty = 7;      // How likely a new leader is made (0-9)
00053 int matrix_diff_value = 8;      // How much to decrement the next section of a trail
00054 
00055 /* *********************** */
00056 // Wave Function Control Variables
00057 /* *********************** */
00058 int wave_update_time = 70;     // How often to update the entire wave function
00059 
00060 /* *********************** */
00061 // Waves Function Control Variables
00062 /* *********************** */
00063 int waves_update_time = 70;    // How often to update the entire wave function
00064 
00065 /* *********************** */
00066 // Tunnel Function Control Variables
00067 /* *********************** */
00068 int tunnel_update_time = 70;    // How often to update the entire wave function
00069 
00070 /* *********************** */
00071 // Rain Function Control Variables
00072 /* *********************** */
00073 int rain_update_time = 50;    // How often to update the entire matrix function
00074 int drop_time_diff = 200;    // How often to try and make a new leader
00075 int drop_probabilty = 2;      // How likely a new leader is made (0-9)
00076 
00077 /* *********************** */
00078 // On-Board LEDs
00079 /* *********************** */
00080 DigitalOut led1(LED1);
00081 DigitalOut led2(LED2);
00082 DigitalOut led3(LED3);
00083 DigitalOut led4(LED4);
00084 
00085 /* *********************** */
00086 // *** Positive Control Pins (8) = Pins 23-30  *** //
00087 /* *********************** */
00088 DigitalOut posC0(p30);
00089 DigitalOut posC1(p29);
00090 DigitalOut posC2(p28);
00091 DigitalOut posC3(p27);
00092 DigitalOut posC4(p26);
00093 DigitalOut posC5(p25);
00094 DigitalOut posC6(p24);
00095 DigitalOut posC7(p23);
00096 
00097 /* *********************** */
00098 // *** Positive MUX Control Pins (2) = Pins 21-22  *** //
00099 /* *********************** *//* *********************** */
00100 DigitalOut posM0(p22);
00101 DigitalOut posM1(p21);
00102 
00103 /* *********************** */
00104 // *** Negative MUX Control Pins (2) = Pins 13-14  *** //
00105 /* *********************** */
00106 DigitalOut negM0(p14);
00107 DigitalOut negM1(p13);
00108 
00109 /* *********************** */
00110 // *** Output Enable Control Pins (2) = Pins 19-20  *** //
00111 //  Output Enable (Active LOW)
00112 /* *********************** */
00113 DigitalOut posOE(p19);
00114 DigitalOut negOE(p20);
00115 
00116 /* *********************** */
00117 // *** Negative Control Pins (8) = Pins 5-12  *** //
00118 /* *********************** */
00119 DigitalOut negC0(p5);
00120 DigitalOut negC1(p6);
00121 DigitalOut negC2(p7);
00122 DigitalOut negC3(p8);
00123 DigitalOut negC4(p9);
00124 DigitalOut negC5(p10);
00125 DigitalOut negC6(p11);
00126 DigitalOut negC7(p12);
00127 
00128 /* *********************** */
00129 // Sweep LEDs Function
00130 /* *********************** */
00131 void sweepLEDs(){
00132     led1 = 1;
00133     wait(0.05);
00134     led2 = 1;
00135     led1 = 0;
00136     wait(0.05);
00137     led3 = 1;
00138     led2 = 0;
00139     wait(0.05);
00140     led4 = 1;
00141     led3 = 0;
00142     wait(0.1);
00143     led4 = 0;
00144 }
00145 
00146 
00147 /* ************************************************************ */
00148 /* ******************** BASIC FUNCTIONS *********************** */
00149 /* ************************************************************ */
00150 /* *********************** */
00151 // Pulse LEDs Function
00152 /* *********************** */
00153 void pulseLEDs(int count){
00154     for(int i=0; i<count; i++){
00155         led1 = 1;
00156         led2 = 1;
00157         led3 = 1;
00158         led4 = 1;
00159         wait(0.1);
00160         led1 = 0;
00161         led2 = 0;
00162         led3 = 0;
00163         led4 = 0;
00164         wait(0.1);
00165      }
00166 }