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.
Dependencies: mbed
main.cpp
00001 #include "mbed.h" 00002 00003 DigitalOut myled(LED1); 00004 DigitalOut T1(PB_3); 00005 DigitalOut T2(PB_4); 00006 DigitalOut T3(PB_5); 00007 DigitalOut T4(PB_10); 00008 00009 int val = 0; 00010 00011 int main() { 00012 while(1) { 00013 while(val <= 50) { 00014 myled = 1; // LED is ON 00015 T1 = 1; 00016 T2 = 0; 00017 T3 = 0; 00018 T4 = 0; 00019 wait(0.01); // 200 ms 00020 myled = 0; // LED is OFF 00021 T1 = 0; 00022 T2 = 1; 00023 T3 = 0; 00024 T4 = 0; 00025 wait(0.01); // 1 sec 00026 T1 = 0; 00027 T2 = 0; 00028 T3 = 1; 00029 T4 = 0; 00030 wait(0.01); 00031 T1 = 0; 00032 T2 = 0; 00033 T3 = 0; 00034 T4 = 1; 00035 wait(0.01); 00036 val = val + 1; 00037 } 00038 while(val >= 0) { 00039 myled = 1; // LED is ON 00040 T1 = 0; 00041 T2 = 0; 00042 T3 = 1; 00043 T4 = 0; 00044 wait(0.01); // 200 ms 00045 myled = 0; // LED is OFF 00046 T1 = 0; 00047 T2 = 1; 00048 T3 = 0; 00049 T4 = 0; 00050 wait(0.01); // 1 sec 00051 T1 = 1; 00052 T2 = 0; 00053 T3 = 0; 00054 T4 = 0; 00055 wait(0.01); 00056 T1 = 0; 00057 T2 = 0; 00058 T3 = 0; 00059 T4 = 1; 00060 wait(0.01); 00061 val = val - 1; 00062 } 00063 } 00064 }
Generated on Sat Jul 16 2022 08:22:16 by
1.7.2