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.
main.cpp
00001 #include "mbed.h" 00002 #define t 0.02 00003 DigitalOut a[]={PA_0,PA_1,PA_2,PA_3,PA_4,PA_5,PA_6,PA_7,PA_8,PA_9,PA_10,PA_11,PA_12,PA_13,PA_14,PA_15}; 00004 DigitalOut b[]={PB_0,PB_1,PB_2,PB_3,PB_4,PB_5,PB_6,PB_7,PB_8,PB_9,PB_10,PB_11,PB_12,PB_13,PB_14,PB_15}; 00005 DigitalOut c[]={PC_0,PC_1,PC_2,PC_3,PC_4,PC_5,PC_6,PC_7,PC_8,PC_9,PC_10,PC_11,PC_12,PC_13,PC_14,PC_15}; 00006 DigitalOut d[]={PD_2}; 00007 DigitalOut x[35]={PB_8,PC_15,PA_0,PA_1,PC_8,PA_3,PA_9,PA_10,PA_6,PA_7, PC_6,PB_1,PB_7,PB_6,PB_0,PC_11,PC_12,PD_2,PC_3, 00008 PC_2,PB_4,PB_5,PB_3,PC_14,PB_9,PC_1,PC_0,PC_13,PA_4,PA_5,PA_13,PA_14,PA_2,PC_4,PC_5}; 00009 00010 //注意!此程序会占用st-link所用引脚,在此程序运行时无法烧录新程序 00011 //烧录新程序:按住复位连接st-link,大概2秒后松手,烧录时先按住复位,进行复制,松开复位时才会烧录 00012 00013 int main() 00014 { 00015 //先亮一遍 00016 for(int i=0;i<16;i++) 00017 { 00018 a[i].write(1); 00019 } 00020 for(int i=0;i<16;i++) 00021 { 00022 b[i].write(1); 00023 } 00024 for(int i=0;i<16;i++) 00025 { 00026 c[i].write(1); 00027 } 00028 d[0].write(1); 00029 wait(t); 00030 while(1) 00031 { 00032 //流水灯 00033 // 00034 for(int i=0;i<35;i++) 00035 { 00036 x[i].write(1); 00037 wait(t); 00038 } 00039 for(int i=0;i<35;i++) 00040 { 00041 x[i].write(1); 00042 wait(t); 00043 } 00044 for(int i=0;i<35;i++) 00045 { 00046 x[i].write(0); 00047 wait(t); 00048 } 00049 // 00050 wait(1); 00051 for(int i=0;i<40;i++) 00052 { 00053 if(i<35){x[i].write(1);} 00054 if(i>4&&i<40){x[i-5].write(0);} 00055 wait(t); 00056 } 00057 00058 } 00059 }
Generated on Fri Jul 15 2022 21:11:44 by
1.7.2