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.
Fork of location-puck by
main.cpp@2:67d603617000, 2014-06-19 (annotated)
- Committer:
- cristea
- Date:
- Thu Jun 19 10:47:28 2014 +0200
- Revision:
- 2:67d603617000
- Parent:
- 1:345039810771
- Child:
- 3:4cb285fb29e7
Update blinker to be more aestethically pleasing
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| cristea | 0:f4fbeaabdff5 | 1 | #include <mbed.h> |
| cristea | 0:f4fbeaabdff5 | 2 | |
| cristea | 0:f4fbeaabdff5 | 3 | DigitalOut led1(LED1); |
| cristea | 0:f4fbeaabdff5 | 4 | DigitalOut led2(LED2); |
| cristea | 0:f4fbeaabdff5 | 5 | |
| cristea | 0:f4fbeaabdff5 | 6 | void clear() { |
| cristea | 0:f4fbeaabdff5 | 7 | led1 = 0; |
| cristea | 0:f4fbeaabdff5 | 8 | led2 = 0; |
| cristea | 0:f4fbeaabdff5 | 9 | } |
| cristea | 0:f4fbeaabdff5 | 10 | |
| cristea | 0:f4fbeaabdff5 | 11 | void cycle(float delta) { |
| cristea | 0:f4fbeaabdff5 | 12 | clear(); |
| cristea | 0:f4fbeaabdff5 | 13 | led1 = 1; |
| cristea | 0:f4fbeaabdff5 | 14 | wait(delta); |
| cristea |
2:67d603617000 | 15 | |
| cristea |
2:67d603617000 | 16 | clear(); |
| cristea |
2:67d603617000 | 17 | led1 = 1; |
| cristea |
2:67d603617000 | 18 | wait(delta); |
| cristea | 0:f4fbeaabdff5 | 19 | |
| cristea | 0:f4fbeaabdff5 | 20 | clear(); |
| cristea | 0:f4fbeaabdff5 | 21 | led2 = 1; |
| cristea | 0:f4fbeaabdff5 | 22 | wait(delta); |
| cristea |
2:67d603617000 | 23 | |
| cristea |
2:67d603617000 | 24 | clear(); |
| cristea |
2:67d603617000 | 25 | led2 = 1; |
| cristea |
2:67d603617000 | 26 | wait(delta); |
| cristea | 0:f4fbeaabdff5 | 27 | } |
| cristea | 0:f4fbeaabdff5 | 28 | |
| cristea | 0:f4fbeaabdff5 | 29 | void drums(float delta) { |
| cristea | 0:f4fbeaabdff5 | 30 | clear(); |
| cristea | 0:f4fbeaabdff5 | 31 | led1 = 1; |
| cristea | 0:f4fbeaabdff5 | 32 | wait(delta); |
| cristea |
2:67d603617000 | 33 | |
| cristea |
2:67d603617000 | 34 | clear(); |
| cristea |
2:67d603617000 | 35 | led2 = 1; |
| cristea |
2:67d603617000 | 36 | wait(delta); |
| cristea |
2:67d603617000 | 37 | |
| cristea |
2:67d603617000 | 38 | clear(); |
| cristea |
2:67d603617000 | 39 | led2 = 1; |
| cristea |
2:67d603617000 | 40 | wait(delta); |
| cristea | 0:f4fbeaabdff5 | 41 | } |
| cristea | 0:f4fbeaabdff5 | 42 | |
| cristea | 0:f4fbeaabdff5 | 43 | int main() { |
| cristea | 0:f4fbeaabdff5 | 44 | while(1) { |
| cristea | 0:f4fbeaabdff5 | 45 | drums(0.3); |
| cristea |
2:67d603617000 | 46 | cycle(0.3); |
| cristea | 0:f4fbeaabdff5 | 47 | } |
| cristea |
1:345039810771 | 48 | } |
