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@0:ccaab3b367fc, 2015-11-27 (annotated)
- Committer:
- mahantesh
- Date:
- Fri Nov 27 08:00:50 2015 +0000
- Revision:
- 0:ccaab3b367fc
library
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mahantesh | 0:ccaab3b367fc | 1 | #include "mbed.h" |
| mahantesh | 0:ccaab3b367fc | 2 | |
| mahantesh | 0:ccaab3b367fc | 3 | DigitalOut pin(LED2); |
| mahantesh | 0:ccaab3b367fc | 4 | |
| mahantesh | 0:ccaab3b367fc | 5 | void flash(int n) { |
| mahantesh | 0:ccaab3b367fc | 6 | for(int i=0; i<n*2; i++) { |
| mahantesh | 0:ccaab3b367fc | 7 | pin = !pin; |
| mahantesh | 0:ccaab3b367fc | 8 | wait(0.2); |
| mahantesh | 0:ccaab3b367fc | 9 | } |
| mahantesh | 0:ccaab3b367fc | 10 | } |
| mahantesh | 0:ccaab3b367fc | 11 | |
| mahantesh | 0:ccaab3b367fc | 12 | int main() { |
| mahantesh | 0:ccaab3b367fc | 13 | // do something... |
| mahantesh | 0:ccaab3b367fc | 14 | |
| mahantesh | 0:ccaab3b367fc | 15 | // flash 5 times |
| mahantesh | 0:ccaab3b367fc | 16 | flash(5); |
| mahantesh | 0:ccaab3b367fc | 17 | |
| mahantesh | 0:ccaab3b367fc | 18 | // do something else |
| mahantesh | 0:ccaab3b367fc | 19 | |
| mahantesh | 0:ccaab3b367fc | 20 | // flash 2 times |
| mahantesh | 0:ccaab3b367fc | 21 | flash(2); |
| mahantesh | 0:ccaab3b367fc | 22 | |
| mahantesh | 0:ccaab3b367fc | 23 | // do another thing |
| mahantesh | 0:ccaab3b367fc | 24 | } |