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 "DigitalOut.h" 00003 00004 //fading LED's on mbed 00005 //feb 5 2010 00006 00007 PwmOut lda(P1_18); 00008 PwmOut ldb(P1_20); 00009 PwmOut ldc(P1_21); 00010 PwmOut ldd(P1_23); 00011 00012 int main() { 00013 00014 00015 lda=ldb=ldc=ldd= 1; 00016 ldb=ldd= 0; 00017 00018 while (1) { 00019 while (lda < 1) { 00020 lda = lda + 0.02; 00021 ldb = ldb - 0.01; 00022 ldc = ldc + 0.05; 00023 ldd = ldd - 0.005; 00024 wait(0.01); 00025 } 00026 00027 while (lda > 0) { 00028 lda = lda - 0.02; 00029 ldb = ldb - 0.01; 00030 ldc = ldc + 0.01; 00031 ldd = ldd + 0.005; 00032 wait(0.01); 00033 } 00034 00035 // lda = !lda; 00036 while (lda < 1) { 00037 lda = lda + 0.02; 00038 ldb = ldb + 0.01; 00039 ldc = ldc + 0.005; 00040 ldd = ldd - 0.015; 00041 wait(0.01); 00042 } 00043 00044 while (lda > 0) { 00045 lda = lda - 0.02; 00046 ldb = ldb + 0.01; 00047 ldc = ldc - 0.02; 00048 ldd = ldd + 0.015; 00049 wait(0.01); 00050 } 00051 00052 00053 } 00054 } 00055 //LED1 = P1_18, 00056 //LED2 = P1_20 00057 //LED3 = P1_21 00058 //LED4 = P1_23 00059 //p21 = p2_5 00060 //p22 = p2_4 00061 //p23 = P2_3 00062 //p24 = P2_2 00063 //p25 = P2_ 1 00064 //p26 = P2_0
Generated on Wed Jul 13 2022 00:40:18 by
1.7.2