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 DigitalOut myled(p5); 00004 DigitalOut myled2(p6); 00005 DigitalOut myled3(p7); 00006 DigitalOut myled4(p8); 00007 DigitalIn boton1(p9); 00008 float dormir = 0.509; 00009 00010 int main() { 00011 00012 while(1) { 00013 if(dormir == 0) { dormir = 1;} 00014 if(boton1 & dormir != 0.01) { 00015 dormir = (dormir - 0.01); 00016 } 00017 00018 myled = 1; 00019 if(dormir == 0) { dormir = 1;} 00020 00021 if(boton1 & dormir != 0.01) { 00022 dormir = (dormir - 0.01); 00023 } 00024 00025 wait(dormir); 00026 myled = 0; 00027 if(dormir == 0) { dormir = 1;} 00028 00029 if(boton1 & dormir != 0.01) { 00030 dormir = (dormir - 0.01); 00031 } 00032 00033 wait(dormir); 00034 myled2 = 1; 00035 if(dormir == 0) { dormir = 1;} 00036 00037 if(boton1 & dormir != 0.01) { 00038 dormir = (dormir - 0.01); 00039 } 00040 00041 wait(dormir); 00042 myled2 = 0; 00043 if(dormir == 0) { dormir = 1;} 00044 00045 if(boton1 & dormir != 0.01) { 00046 dormir = (dormir - 0.01); 00047 } 00048 00049 wait(dormir); 00050 myled3 = 1; 00051 if(dormir == 0) { dormir = 1;} 00052 00053 if(boton1 & dormir != 0.01) { 00054 dormir = (dormir - 0.01); 00055 } 00056 00057 wait(dormir); 00058 myled3 = 0; 00059 00060 if(dormir == 0) { dormir = 1;} 00061 00062 if(boton1 & dormir != 0.01) { 00063 dormir = (dormir - 0.01); 00064 } 00065 00066 wait(dormir); 00067 myled4 = 1; 00068 if(dormir == 0) { dormir = 1;} 00069 00070 if(boton1 & dormir != 0.01) { 00071 dormir = (dormir - 0.01); 00072 } 00073 00074 wait(dormir); 00075 myled4 = 0; 00076 if(dormir == 0) { dormir = 1;} 00077 00078 if(boton1 & dormir != 0.01) { 00079 dormir = (dormir - 0.01); 00080 } 00081 00082 wait(dormir); 00083 } 00084 } 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 int main() { 00102 while(1) { 00103 myled = 1; 00104 wait(0.2); 00105 myled = 0; 00106 wait(0.2); 00107 } 00108 }
Generated on Thu Jul 21 2022 20:47:05 by
1.7.2