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.
Dependencies: mbed
main.cpp
00001 #include "led_func.h" 00002 00003 /*int main(){ 00004 while(1){ 00005 myLED=L; 00006 CLK=L; 00007 LAT=L; 00008 Address=0; 00009 wait(0.1); 00010 for(char i=0;i<1;i++){ 00011 CLK=H; 00012 wait(0.1); 00013 CLK=L; 00014 wait(0.1); 00015 Red1=1; 00016 wait(0.1); 00017 } 00018 LAT=H; 00019 wait(0.1); 00020 LAT=L; 00021 wait(0.1); 00022 OE=L; 00023 myLED=H; 00024 wait(0.1); 00025 } 00026 }*/ 00027 00028 int main(){ 00029 ResetBoard(); 00030 for(char i=0;i<16;i++){ 00031 for(char j=0;j<8;j++){ 00032 led_board[i][j].blue=true; 00033 } 00034 } 00035 while(1){ 00036 PrintBoard(); 00037 } 00038 } 00039 00040 /*int main(){ 00041 LED LedBoard; 00042 LedBoard.ResetBoard(); 00043 char test[16][16]={{0,1,2,4,3,5,6,7,0,0,0,0,0,0,0,0}}; 00044 LedBoard.led_board[0][0]=B; 00045 while(1){ 00046 LedBoard.PrintBoard(); 00047 } 00048 }*/ 00049 /*char k=0; 00050 00051 void Init(){ 00052 OE=1; 00053 Address=0; 00054 CLK=0; 00055 LAT=0; 00056 } 00057 00058 void WriteLine(uint8_t line){ 00059 Init(); 00060 OE=1; 00061 Red1=1; 00062 Green1=0; 00063 Blue1=0; 00064 Red2=1; 00065 Green2=0; 00066 Blue2=0; 00067 Address=line; 00068 for(int j=0;j<32;j++){ 00069 if(line==3&&j==31)Blue1=1; 00070 CLK=1; 00071 CLK=0; 00072 } 00073 LAT=1; 00074 LAT=0; 00075 OE=0; 00076 } 00077 00078 int main(){ 00079 while(1){ 00080 for(int i=0;i<4;i++){ 00081 WriteLine(i); 00082 wait_us(100); 00083 } 00084 } 00085 }*/ 00086 /*BusOut pin(PC_7,PB_6,PA_7);//9 DS(データ),10 ST_CP(ラッチ),11 SH_CP(クロック) 00087 DigitalOut datapin(PC_7);//9 DS 00088 DigitalOut latchpin(PB_6);//10 ST_CP 00089 DigitalOut clockpin(PA_7);//11 SH_CP 00090 00091 uint8_t datared; 00092 uint8_t datagreen; 00093 uint8_t datablue; 00094 uint8_t dataarrayred[10]; 00095 uint8_t dataarraygreen[10]; 00096 uint8_t dataarrayblue[10]; 00097 00098 void setup(){ 00099 dataarrayred[0]=0xff; 00100 dataarrayred[1]=0xfe; 00101 dataarrayred[2]=0xfc; 00102 dataarrayred[3]=0xf8; 00103 dataarrayred[4]=0xf0; 00104 dataarrayred[5]=0xe0; 00105 dataarrayred[6]=0xc0; 00106 dataarrayred[7]=0x80; 00107 dataarrayred[8]=0x00; 00108 00109 dataarraygreen[0]=0xff; 00110 dataarraygreen[1]=0xfe; 00111 dataarraygreen[2]=0xfc; 00112 dataarraygreen[3]=0xf8; 00113 dataarraygreen[4]=0xf0; 00114 dataarraygreen[5]=0xe0; 00115 dataarraygreen[6]=0xc0; 00116 dataarraygreen[7]=0x80; 00117 dataarraygreen[8]=0x00; 00118 00119 dataarrayblue[0]=0xff; 00120 dataarrayblue[1]=0xfe; 00121 dataarrayblue[2]=0xfc; 00122 dataarrayblue[3]=0xf8; 00123 dataarrayblue[4]=0xf0; 00124 dataarrayblue[5]=0xe0; 00125 dataarrayblue[6]=0xc0; 00126 dataarrayblue[7]=0x80; 00127 dataarrayblue[8]=0x00; 00128 } 00129 00130 void shiftout(uint8_t data){ 00131 datapin=0; 00132 clockpin=0; 00133 for(int i=7;i>0;i--){ 00134 clockpin=0; 00135 wait_us(1); 00136 if (data&(1<<i)){ 00137 datapin=0; 00138 }else{ 00139 datapin=1; 00140 } 00141 wait_us(1); 00142 clockpin=1; 00143 wait_us(1); 00144 datapin=0; 00145 wait_us(1); 00146 } 00147 clockpin=0; 00148 } 00149 00150 void loop(){ 00151 for(int i=0;i<10;i++){ 00152 datared=dataarrayred[i]; 00153 datagreen=dataarraygreen[i]; 00154 datablue=dataarrayblue[i]; 00155 latchpin=1; 00156 shiftout(datagreen); 00157 shiftout(datared); 00158 shiftout(datablue); 00159 latchpin=0; 00160 wait(3); 00161 } 00162 } 00163 00164 int main(){ 00165 setup(); 00166 while(1){ 00167 loop(); 00168 } 00169 }*/ 00170 /*BusInOut kathode(PC_1,PB_0,PA_4,PA_1); 00171 //BusInOut led(PD_2,PC_11,PC_10,PC_12,PA_13,PA_14,PA_15,PB_7,PC_13,PC_3,PC_0,PA_0); 00172 BusInOut redled(PA_13,PC_13,PA_0,PA_13); 00173 BusInOut greenled(PB_7,PC_0,PD_2,PC_12); 00174 BusInOut blueled(PA_15,PC_3,PC_11,PC_10); 00175 00176 int main() { 00177 kathode.output(); 00178 redled.output(); 00179 redled.mode(OpenDrain); 00180 greenled.output(); 00181 greenled.mode(OpenDrain); 00182 blueled.output(); 00183 blueled.mode(OpenDrain); 00184 while(1){ 00185 kathode=0b0001; 00186 for(int i=0;i<4;i++){ 00187 redled=0b0000; 00188 greenled=0b0000; 00189 blueled=0b1111; 00190 wait_us(1); 00191 redled=0; 00192 greenled=0; 00193 blueled=0; 00194 kathode=kathode<<1; 00195 } 00196 } 00197 kathode=0b1111; 00198 led.output(); 00199 led.mode(OpenDrain); 00200 led=0xffff; 00201 while(1){} 00202 }*/
Generated on Wed Jul 13 2022 23:06:20 by
1.7.2