music mixer code
Dependencies: mbed wave_player mbed-rtos SimpleRGB 4DGL-uLCD-SE PinDetect
main.cpp
- Committer:
- kswanson31
- Date:
- 2016-10-09
- Revision:
- 0:51d88b4e2b23
- Child:
- 1:ff69d2d97a2c
File content as of revision 0:51d88b4e2b23:
#include "mbed.h" #include "rtos.h" /* 1 init/declare Ticker first; Ticker second; Ticker third; Ticker fourth; DigitalOut led1(LED1); DigitalOut led2(LED2); DigitalOut led3(LED3); DigitalOut led4(LED4); void one() { // attached to ticker object. will be called after time given led1 = !led1; // flip the value of the led } // nothing returned void two() { led2 = !led2; } void three() { led3 = !led3; } void fourth() { led4 = !led4; } */// - 1 /* 2 init/declare */ void uLCD_reboot_thread(void const *args) { // show reboot process, associated with clip of apple restart while (1) { // lock, print 'Rebooting!' to uLCD with "progress_bar" underneath // draw progress bar 8 sec // draw an ascii 'apple' // unlock, wait for 52 } } void uLCD_status_thread(void const *args) { // show time with smile, frown, sad face at top right while (1) { // lock, update time at top right with smiley at top left // unlock, wait for 20 sec // lock, change to frown // unlock, wait for 20 sec // lock, change to sad // unlock, wait for 20 sec } } void rainbow_led_thread(void const *args) { // reboot with white, then cycle through apple rainbow colors while (1) { // bright white, dim to nothing over 4 sec // green // yellow // orange // red // purple // blue } } // - 2 int main() { /* 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 while(1) { /* 2 speaker 'thread' calls */ // speaker plays mac reboot sound, error sound occasionally // play reboot sound // wait 20 // error // wait 20 // error // wait 20 } // interupts will occur automatically }