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 00003 PwmOut led1(LED1),led2(LED2),led3(LED3),led4(LED4); 00004 float a=0.25f,b=0,c=-0.25f,d=-0.5f; 00005 int aa=0,bb=0,cc=0,dd=0; 00006 00007 int main() { 00008 while (1) { 00009 if (a>=1) { 00010 aa=1; 00011 } else if (a<-0.5) { 00012 aa=0; 00013 }; 00014 if (b>=1) { 00015 bb=1; 00016 } else if (b<-0.5) { 00017 bb=0; 00018 }; 00019 if (c>=1) { 00020 cc=1; 00021 } else if (c<-0.5) { 00022 cc=0; 00023 }; 00024 if (d>=1) { 00025 dd=1; 00026 } else if (d<-0.5) { 00027 dd=0; 00028 }; 00029 00030 if (aa==0) { 00031 a+=0.025f; 00032 } else { 00033 a-=0.075f; 00034 }; 00035 if (bb==0) { 00036 b+=0.025f; 00037 } else { 00038 b-=0.075f; 00039 }; 00040 if (cc==0) { 00041 c+=0.025f; 00042 } else { 00043 c-=0.075f; 00044 }; 00045 if (dd==0) { 00046 d+=0.025f; 00047 } else { 00048 d-=0.075f; 00049 }; 00050 00051 led1 = a; 00052 led2 = b; 00053 led3 = c; 00054 led4 = d; 00055 00056 wait(0.025); 00057 } 00058 }
Generated on Wed Sep 6 2023 18:10:36 by
1.7.2