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
- Committer:
- logostarr
- Date:
- 2022-09-30
- Revision:
- 1:dcd96a8ef857
- Parent:
- 0:5014bf742e9b
- Child:
- 2:8b678520a9fb
File content as of revision 1:dcd96a8ef857:
#include "mbed.h"
Ticker flipper;
DigitalOut led1(LED1);
DigitalOut led2(LED2);
DigitalOut led3(LED3);
DigitalOut led4(LED4);
void flip2() {
led2 = !led2;
}
void flip1() {
led1 = !led1;
}
void flip3() {
led3 = !led3;
}
void flip4() {
led4 = !led4;
}
int main() {
led2 = 1;
flipper.attach(&flip2, 2 ); // the address of the function to be attached (flip) and the interval (2 seconds)
flipper.attach(&flip1, 1);
flipper.attach(&flip3, 4);
flipper.attach(&flip4, 8);
// spin in a main loop. flipper will interrupt it to call flip
while(1) {
led1 = !led1;
}
}