Josh Davy / Mbed OS MUSIC_K64F
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2018 ARM Limited
00003  * SPDX-License-Identifier: Apache-2.0
00004  */
00005 
00006 #include "mbed.h"
00007 #include "stats_report.h"
00008 #include "Music.h"
00009 #include "SoundData.h"
00010 
00011 DigitalOut led1(LED1);
00012 Music music;
00013 #define SLEEP_TIME                  500 // (msec)
00014 #define PRINT_AFTER_N_LOOPS         20
00015 
00016 // main() runs in its own thread in the OS
00017 int main()
00018 {
00019     SystemReport sys_state( SLEEP_TIME * PRINT_AFTER_N_LOOPS /* Loop delay time in ms */);
00020     music.init(sound_data,NUM_ELEMENTS);
00021     int count = 0;
00022     while (true) {
00023         // Blink LED and wait 0.5 seconds
00024         music.play_next();
00025         //wait_us(1);
00026         
00027         ++count;
00028     }
00029 }