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.
Diff: main.cpp
- Revision:
- 0:f0739e8427ec
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed May 26 22:48:36 2010 +0000 @@ -0,0 +1,58 @@ +#include "mbed.h" + +PwmOut led1(LED1),led2(LED2),led3(LED3),led4(LED4); +float a=0.25f,b=0,c=-0.25f,d=-0.5f; +int aa=0,bb=0,cc=0,dd=0; + +int main() { + while (1) { + if (a>=1) { + aa=1; + } else if (a<-0.5) { + aa=0; + }; + if (b>=1) { + bb=1; + } else if (b<-0.5) { + bb=0; + }; + if (c>=1) { + cc=1; + } else if (c<-0.5) { + cc=0; + }; + if (d>=1) { + dd=1; + } else if (d<-0.5) { + dd=0; + }; + + if (aa==0) { + a+=0.025f; + } else { + a-=0.075f; + }; + if (bb==0) { + b+=0.025f; + } else { + b-=0.075f; + }; + if (cc==0) { + c+=0.025f; + } else { + c-=0.075f; + }; + if (dd==0) { + d+=0.025f; + } else { + d-=0.075f; + }; + + led1 = a; + led2 = b; + led3 = c; + led4 = d; + + wait(0.025); + } +}