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 // a flashlight with 4 Leds like the KID in Nightrider 00004 00005 PwmOut led_1(LED1); 00006 PwmOut led_2(LED2); 00007 PwmOut led_3(LED3); 00008 PwmOut led_4(LED4); 00009 00010 int main() { 00011 00012 float 00013 q; 00014 00015 while(1) { 00016 for(float p = 0.0f; p < 4.0f; p += 0.1f) { 00017 led_1 = p; 00018 led_2 = p-1.0; 00019 led_3 = p-2.0; 00020 led_4 = p-3.0; 00021 wait(0.01); 00022 } 00023 for(float p = 4.0f; p > 0.0f; p -= 0.1f) { 00024 led_4 = p; 00025 led_3 = p-1.0; 00026 led_2 = p-2.0; 00027 led_1 = p-3.0; 00028 wait(0.01); 00029 } 00030 for(float p = 0.0f; p < 4.0f; p += 0.1f) { 00031 led_4 = p; 00032 led_3 = p-1.0; 00033 led_2 = p-2.0; 00034 led_1 = p-3.0; 00035 wait(0.01); 00036 } 00037 for(float p = 4.0f; p > 0.0f; p -= 0.1f) { 00038 led_1 = p; 00039 led_2 = p-1.0; 00040 led_3 = p-2.0; 00041 led_4 = p-3.0; 00042 wait(0.01); 00043 } 00044 } 00045 }
Generated on Tue Sep 13 2022 20:57:44 by
1.7.2