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 #include "m3pi.h" 00003 00004 m3pi m3pi; 00005 00006 DigitalOut led1(p19); 00007 DigitalOut led2(p18); 00008 DigitalOut led3(p17); 00009 DigitalOut led4(p16); 00010 DigitalOut led5(p15); 00011 DigitalOut led6(p14); 00012 DigitalOut led7(p13); 00013 00014 int s1[]={0,1,0,0,0,1,0,1,1,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0}; 00015 int s2[]={0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0}; 00016 int s3[]={0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0}; 00017 int s4[]={0,1,1,1,1,1,0,1,1,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0}; 00018 int s5[]={0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0}; 00019 int s6[]={0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0}; 00020 int s7[]={0,1,0,0,0,1,0,1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,1,0,0,1,1,1,0,0}; 00021 00022 int main() { 00023 int i,j; 00024 m3pi.locate(0,1); 00025 m3pi.printf("M3PI LED"); 00026 wait (2.0); 00027 m3pi.left(1); // Turn left at full speed 00028 wait (0.1); // wait half a second 00029 for (j=0; j<50; j++) { 00030 for (i=0; i<31; i++) { 00031 led1=s1[i]; 00032 led2=s2[i]; 00033 led3=s3[i]; 00034 led4=s4[i]; 00035 led5=s5[i]; 00036 led6=s6[i]; 00037 led7=s7[i]; 00038 wait (0.005); 00039 } 00040 wait(0.25-0.005*31); 00041 } 00042 wait (0.5); 00043 m3pi.stop(); 00044 }
Generated on Fri Aug 19 2022 17:19:18 by
1.7.2