music mixer code
Dependencies: mbed wave_player mbed-rtos SimpleRGB 4DGL-uLCD-SE PinDetect
Diff: main.cpp
- Revision:
- 3:641770225c44
- Parent:
- 2:c64bfb83fe76
- Child:
- 4:4792f0db029a
--- a/main.cpp Mon Oct 10 22:47:38 2016 +0000 +++ b/main.cpp Tue Oct 11 00:14:04 2016 +0000 @@ -3,8 +3,9 @@ #include "SimpleRGB.h" #define SECOND 1000 // used with threads +DigitalOut led(LED1); // test led -/* 1 init/declare */ +/* 1 init/declare Ticker first; Ticker second; @@ -31,10 +32,10 @@ led4 = !led4; } -// - 1 +*/// - 1 -/* 2 init/declare +/* 2 init/declare */ // lcd thread void uLCD_reboot_thread(void const *args) { @@ -94,29 +95,31 @@ Thread::wait(9 * SECOND); } } -*/// - 2 +// - 2 int main() { - /* 1 calls */ + /* 1 calls led1 = 1, led2 = 1, led3 = 1, led4 = 1; first.attach(&one, 1.0); // attach the function and when to call it second.attach(&two, 2.0); third.attach(&three, 3.0); fourth.attach(&four, 4.0); - // - 1 + */// - 1 - /* 2 calls - Thread thread2(uLCD_reboot_thread); - Thread thread3(uLCD_status_thread); + /* 2 calls */ + //Thread thread2(uLCD_reboot_thread); + //Thread thread3(uLCD_status_thread); Thread thread4(rainbow_led_thread); - */// - 2 + // - 2 + led = 1; + while(true) { - /* 2 speaker 'thread' calls */ + /* 2 speaker 'thread' calls // speaker plays mac reboot sound, error sound occasionally // play reboot sound // wait 20 @@ -124,5 +127,17 @@ // wait 20 // error // wait 20 + */// - 2 + + + // thread testing + led = !led; + Thread::wait(2000); + led = !led; + Thread::wait(1000); + led = !led; + Thread::wait(500); + // - test + } // interupts will occur automatically }