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
- Committer:
- daniogenes
- Date:
- 2010-10-29
- Revision:
- 0:c606bb1acbdc
File content as of revision 0:c606bb1acbdc:
#include "mbed.h"
// a flashlight with 4 Leds like the KID in Nightrider
PwmOut led_1(LED1);
PwmOut led_2(LED2);
PwmOut led_3(LED3);
PwmOut led_4(LED4);
int main() {
float
q;
while(1) {
for(float p = 0.0f; p < 4.0f; p += 0.1f) {
led_1 = p;
led_2 = p-1.0;
led_3 = p-2.0;
led_4 = p-3.0;
wait(0.01);
}
for(float p = 4.0f; p > 0.0f; p -= 0.1f) {
led_4 = p;
led_3 = p-1.0;
led_2 = p-2.0;
led_1 = p-3.0;
wait(0.01);
}
for(float p = 0.0f; p < 4.0f; p += 0.1f) {
led_4 = p;
led_3 = p-1.0;
led_2 = p-2.0;
led_1 = p-3.0;
wait(0.01);
}
for(float p = 4.0f; p > 0.0f; p -= 0.1f) {
led_1 = p;
led_2 = p-1.0;
led_3 = p-2.0;
led_4 = p-3.0;
wait(0.01);
}
}
}