Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
WaitOtherPlayer.cpp
00001 #include "mbed.h" 00002 //************************ Complete to Interface *************************** 00003 // configure library with this code **************************************** 00004 SPI dot_matrix(D11,NC,D13); //mosi miso sclk 00005 DigitalOut lat(PA_12); //6 00006 DigitalOut sb(PA_11); //7 00007 DigitalOut rst(D10); 00008 BusOut open_line(D2,D3,D4,D5,D6,D7,D8,D9); 00009 //c0 c1 c2 c3 c4 c5 c6 c7 dont foget d7 00010 Serial pc(D1, D0); 00011 Timer t; 00012 00013 int counter; 00014 int click = 0; 00015 int swap = 0; 00016 int downter = 60; 00017 uint8_t rgb[3] = {0,0,0}; 00018 00019 00020 int main(){ 00021 00022 dot_matrix.frequency(1000000); 00023 // dot_matrix.format(6,0); 00024 uint8_t wb[3] = {255,255,255}; 00025 uint8_t pic[63][8] ={ 00026 {0xff,0xff,0x42,0x24,0x24,0x42,0x81,0xff}, 00027 {0xff,0xff,0x42,0x24,0x24,0x42,0x81,0xff}, 00028 {0xff,0xff,0x42,0x24,0x24,0x42,0x81,0xff}, 00029 {0xff,0xff,0x42,0x24,0x24,0x42,0x81,0xff}, 00030 {0xff,0xff,0x42,0x24,0x24,0x42,0x81,0xff}, 00031 {0xff,0xff,0x42,0x24,0x24,0x42,0x81,0xff}, 00032 {0xff,0xff,0x42,0x24,0x24,0x42,0x81,0xff}, 00033 00034 {0xff,0xff,0x7e,0x24,0x24,0x42,0x81,0xff}, 00035 {0xff,0xff,0x7e,0x24,0x24,0x42,0x81,0xff}, 00036 {0xff,0xff,0x7e,0x24,0x24,0x42,0x81,0xff}, 00037 {0xff,0xff,0x7e,0x24,0x24,0x42,0x81,0xff}, 00038 {0xff,0xff,0x7e,0x24,0x24,0x42,0x81,0xff}, 00039 {0xff,0xff,0x7e,0x24,0x24,0x42,0x81,0xff}, 00040 {0xff,0xff,0x7e,0x24,0x24,0x42,0x81,0xff}, 00041 00042 {0xff,0xff,0x7e,0x3c,0x24,0x42,0x81,0xff}, 00043 {0xff,0xff,0x7e,0x3c,0x24,0x42,0x81,0xff}, 00044 {0xff,0xff,0x7e,0x3c,0x24,0x42,0x81,0xff}, 00045 {0xff,0xff,0x7e,0x3c,0x24,0x42,0x81,0xff}, 00046 {0xff,0xff,0x7e,0x3c,0x24,0x42,0x81,0xff}, 00047 {0xff,0xff,0x7e,0x3c,0x24,0x42,0x81,0xff}, 00048 {0xff,0xff,0x7e,0x3c,0x24,0x42,0x81,0xff}, 00049 00050 {0xff,0x81,0x7e,0x3c,0x3c,0x42,0x81,0xff}, 00051 {0xff,0x81,0x7e,0x3c,0x3c,0x42,0x81,0xff}, 00052 {0xff,0x81,0x7e,0x3c,0x3c,0x42,0x81,0xff}, 00053 {0xff,0x81,0x7e,0x3c,0x3c,0x42,0x81,0xff}, 00054 {0xff,0x81,0x7e,0x3c,0x3c,0x42,0x81,0xff}, 00055 {0xff,0x81,0x7e,0x3c,0x3c,0x42,0x81,0xff}, 00056 {0xff,0x81,0x7e,0x3c,0x3c,0x42,0x81,0xff}, 00057 00058 {0xff,0x81,0x42,0x3c,0x3c,0x7e,0x81,0xff}, 00059 {0xff,0x81,0x42,0x3c,0x3c,0x7e,0x81,0xff}, 00060 {0xff,0x81,0x42,0x3c,0x3c,0x7e,0x81,0xff}, 00061 {0xff,0x81,0x42,0x3c,0x3c,0x7e,0x81,0xff}, 00062 {0xff,0x81,0x42,0x3c,0x3c,0x7e,0x81,0xff}, 00063 {0xff,0x81,0x42,0x3c,0x3c,0x7e,0x81,0xff}, 00064 {0xff,0x81,0x42,0x3c,0x3c,0x7e,0x81,0xff}, 00065 00066 {0xff,0x81,0x42,0x24,0x3c,0x7e,0xff,0xff}, 00067 {0xff,0x81,0x42,0x24,0x3c,0x7e,0xff,0xff}, 00068 {0xff,0x81,0x42,0x24,0x3c,0x7e,0xff,0xff}, 00069 {0xff,0x81,0x42,0x24,0x3c,0x7e,0xff,0xff}, 00070 {0xff,0x81,0x42,0x24,0x3c,0x7e,0xff,0xff}, 00071 {0xff,0x81,0x42,0x24,0x3c,0x7e,0xff,0xff}, 00072 {0xff,0x81,0x42,0x24,0x3c,0x7e,0xff,0xff}, 00073 00074 {0xff,0x81,0x42,0x24,0x24,0x7e,0xff,0xff}, 00075 {0xff,0x81,0x42,0x24,0x24,0x7e,0xff,0xff}, 00076 {0xff,0x81,0x42,0x24,0x24,0x7e,0xff,0xff}, 00077 {0xff,0x81,0x42,0x24,0x24,0x7e,0xff,0xff}, 00078 {0xff,0x81,0x42,0x24,0x24,0x7e,0xff,0xff}, 00079 {0xff,0x81,0x42,0x24,0x24,0x7e,0xff,0xff}, 00080 {0xff,0x81,0x42,0x24,0x24,0x7e,0xff,0xff}, 00081 00082 {0xff,0x81,0x42,0x24,0x24,0x42,0xff,0xff}, 00083 {0xff,0x81,0x42,0x24,0x24,0x42,0xff,0xff}, 00084 {0xff,0x81,0x42,0x24,0x24,0x42,0xff,0xff}, 00085 {0xff,0x81,0x42,0x24,0x24,0x42,0xff,0xff}, 00086 {0xff,0x81,0x42,0x24,0x24,0x42,0xff,0xff}, 00087 {0xff,0x81,0x42,0x24,0x24,0x42,0xff,0xff}, 00088 {0xff,0x81,0x42,0x24,0x24,0x42,0xff,0xff}, 00089 00090 {0xff,0x81,0x42,0x24,0x24,0x42,0x81,0xff}, 00091 {0xff,0x81,0x42,0x24,0x24,0x42,0x81,0xff}, 00092 {0xff,0x81,0x42,0x24,0x24,0x42,0x81,0xff}, 00093 {0xff,0x81,0x42,0x24,0x24,0x42,0x81,0xff}, 00094 {0xff,0x81,0x42,0x24,0x24,0x42,0x81,0xff}, 00095 {0xff,0x81,0x42,0x24,0x24,0x42,0x81,0xff}, 00096 {0xff,0x81,0x42,0x24,0x24,0x42,0x81,0xff} 00097 }; 00098 uint8_t temp; 00099 int line[8] = {1,2,4,8,16,32,64,128}; 00100 00101 rst = 1; 00102 wait(0.5); 00103 rst = 0; 00104 wait(0.5); 00105 rst = 1; 00106 wait(0.5); 00107 00108 //dot_matrix.format(6,0); 00109 sb = 0; // 6 bit 00110 for(int i = 0; i<8; i++){ 00111 dot_matrix.write(wb[0]); 00112 dot_matrix.write(wb[1]); 00113 dot_matrix.write(wb[2]); 00114 00115 open_line = 0; 00116 // dot_matrix.format(8,0); 00117 sb = 1; // 8 bit 00118 t.start(); 00119 while (1) { 00120 00121 for(int j=0;j<=62;j++){ 00122 swap = swap + 1; 00123 for(int a=0;a<=7;a++){ 00124 temp = pic[j][a]; 00125 counter = counter+1; 00126 if( counter == 60 ){ 00127 click = click+1; 00128 counter=0; 00129 } 00130 if(click == 0){ 00131 rgb[0] = 0; 00132 rgb[1] = 0; 00133 rgb[2] = counter; 00134 } 00135 else if(click == 1){ 00136 rgb[0] = 0; 00137 rgb[1] = counter; 00138 rgb[2] = 60; 00139 } 00140 else if(click == 2){ 00141 rgb[0] = 0; 00142 rgb[1] = 60; 00143 rgb[2] = 60 - counter; 00144 } 00145 else if(click == 3){ 00146 rgb[0] = counter; 00147 rgb[1] = 60; 00148 rgb[2] = 0; 00149 } 00150 else if(click == 4){ 00151 rgb[0] = 60; 00152 rgb[1] = 60 - counter; 00153 rgb[2] = 0; 00154 } 00155 else if(click == 5){ 00156 rgb[0] = 60; 00157 rgb[1] = 0; 00158 rgb[2] = counter; 00159 } 00160 else if(click == 6){ 00161 rgb[0] = 60 - counter; 00162 rgb[1] = 0; 00163 rgb[2] = 60; 00164 } 00165 else if(click == 7){ 00166 rgb[0] = 0; 00167 rgb[1] = 0; 00168 rgb[2] = 60; 00169 click = 1; 00170 } 00171 wait(0.001); 00172 for(int i = 0; i<8; i++){ 00173 00174 if(temp & 0x80){ 00175 dot_matrix.write(rgb[0]); 00176 dot_matrix.write(rgb[1]); 00177 dot_matrix.write(rgb[2]); 00178 } 00179 else{ 00180 dot_matrix.write(0); 00181 dot_matrix.write(0); 00182 dot_matrix.write(0); 00183 } 00184 temp = temp << 1; 00185 } 00186 lat = 1; 00187 lat = 0; 00188 open_line = line[a]; 00189 wait(0.0001); 00190 } 00191 } 00192 00193 //open_line = 0; 00194 00195 } 00196 } 00197 }
Generated on Thu Jul 14 2022 05:16:54 by
1.7.2