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:
- gadgetcafe08
- Date:
- 2010-07-04
- Revision:
- 0:c058fc45eb34
- Child:
- 1:486592635dfd
File content as of revision 0:c058fc45eb34:
#include "mbed.h"
DigitalOut myled1(LED1);
DigitalOut myled2(LED2);
DigitalOut myled3(LED3);
DigitalOut myled4(LED4);
int timeBase = 0;
void tick() {
if ((timeBase += 1) == 10) {
timeBase = 0;
}
}
void blink(DigitalOut *led, int timing) {
if ((timeBase % timing) == 0) {
if (led->read() == 0) {
led->write(1);
} else {
led->write(0);
}
}
}
int main() {
while(1) {
blink(&myled1, 1);
blink(&myled2, 2);
blink(&myled3, 3);
blink(&myled4, 4);
tick();
wait(0.1);
}
}