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:d7214673ab2d, 2019-07-22 (annotated)
- Committer:
- joshdavy
- Date:
- Mon Jul 22 14:45:38 2019 +0000
- Revision:
- 0:d7214673ab2d
a
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| joshdavy | 0:d7214673ab2d | 1 | /* mbed Microcontroller Library |
| joshdavy | 0:d7214673ab2d | 2 | * Copyright (c) 2018 ARM Limited |
| joshdavy | 0:d7214673ab2d | 3 | * SPDX-License-Identifier: Apache-2.0 |
| joshdavy | 0:d7214673ab2d | 4 | */ |
| joshdavy | 0:d7214673ab2d | 5 | |
| joshdavy | 0:d7214673ab2d | 6 | #include "mbed.h" |
| joshdavy | 0:d7214673ab2d | 7 | #include "stats_report.h" |
| joshdavy | 0:d7214673ab2d | 8 | #include "Music.h" |
| joshdavy | 0:d7214673ab2d | 9 | #include "SoundData.h" |
| joshdavy | 0:d7214673ab2d | 10 | |
| joshdavy | 0:d7214673ab2d | 11 | DigitalOut led1(LED1); |
| joshdavy | 0:d7214673ab2d | 12 | Music music; |
| joshdavy | 0:d7214673ab2d | 13 | #define SLEEP_TIME 500 // (msec) |
| joshdavy | 0:d7214673ab2d | 14 | #define PRINT_AFTER_N_LOOPS 20 |
| joshdavy | 0:d7214673ab2d | 15 | |
| joshdavy | 0:d7214673ab2d | 16 | // main() runs in its own thread in the OS |
| joshdavy | 0:d7214673ab2d | 17 | int main() |
| joshdavy | 0:d7214673ab2d | 18 | { |
| joshdavy | 0:d7214673ab2d | 19 | SystemReport sys_state( SLEEP_TIME * PRINT_AFTER_N_LOOPS /* Loop delay time in ms */); |
| joshdavy | 0:d7214673ab2d | 20 | music.init(sound_data,NUM_ELEMENTS); |
| joshdavy | 0:d7214673ab2d | 21 | int count = 0; |
| joshdavy | 0:d7214673ab2d | 22 | while (true) { |
| joshdavy | 0:d7214673ab2d | 23 | // Blink LED and wait 0.5 seconds |
| joshdavy | 0:d7214673ab2d | 24 | music.play_next(); |
| joshdavy | 0:d7214673ab2d | 25 | //wait_us(1); |
| joshdavy | 0:d7214673ab2d | 26 | |
| joshdavy | 0:d7214673ab2d | 27 | ++count; |
| joshdavy | 0:d7214673ab2d | 28 | } |
| joshdavy | 0:d7214673ab2d | 29 | } |