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.
Diff: main.cpp
- Revision:
- 12:60c531df03fd
- Parent:
- 11:c0728c05f977
- Child:
- 13:3b05cd187c41
- Child:
- 14:839ab5f50d40
diff -r c0728c05f977 -r 60c531df03fd main.cpp --- a/main.cpp Tue Oct 11 22:22:27 2016 +0000 +++ b/main.cpp Wed Oct 12 10:55:59 2016 +0000 @@ -1,5 +1,6 @@ #include "LaLaBox.h" Serial pc_uart(PA_2, PA_3); +Serial bt_uart(PA_9, PA_10); // ---------------- Local global variables -------------- @@ -97,10 +98,10 @@ DEBUG("------------------------------------------\n\r"); DEBUG("----- LaLaBox (CreaLab) version 1.0 ----\n\r"); DEBUG("------------------------------------------\n\r"); - help(); + // help(); DEBUG("------------------------------------------\n\r"); ledBand.SetColor(BLACK); - DEBUG("SystemCoreClock = %d Hz = %f\n\r", SystemCoreClock); + DEBUG("SystemCoreClock = %d Hz =\n\r", SystemCoreClock); CATCH_BUTTON(myButton,clicked); CATCH_BUTTON(buttonBox,clicked); @@ -108,20 +109,21 @@ buttonBox.rise(&clicked); // PLAY_NOTE(la, buzzer); + DEBUG("Wait 2s\n\r", SystemCoreClock); wait(2); // Some delay myled = 0; // Real stuff starts here + DEBUG("Enter a command : \n\r", SystemCoreClock); while(1) { char command; // Command to execute DEBUG(">> "); - command = pc_uart.getc(); + command = bt_uart.getc(); DEBUG("%c", command); flaghelp = false; switch (command) { case 'h': - DEBUG("List of commands:\n\r"); - DEBUG(" h --> Help, display list of cammands\n\r"); + help(); flaghelp=true; CASE('o', "OpenBox", motorBox.RunDegrees(COUNTERCLOCKWISE, (float)60.0); ) CASE('c', "CloseBox", motorBox.RunDegrees(CLOCKWISE, (float)60.0); ) @@ -130,6 +132,11 @@ CASE('f', "Dancer Clock Wise ", motorDancer.RunInfinite(CLOCKWISE); ) CASE('j', "Dancer Counter Clock Wise ", motorDancer.RunInfinite(COUNTERCLOCKWISE); ) CASE('s', "STOP ", clicked(); ) + CASE('m', "Music 1", PLAY_MUSIC(song_xfile,buzzer); ) + CASE('n', "Music 2", PLAY_MUSIC(song_lightmyfire,buzzer); ) + CASE('p', "Music 3", PLAY_MUSIC(song_greensleaves,buzzer); ) + CASE('q', "Music 4", PLAY_MUSIC(song_christmas,buzzer); ) + CASE('r', "Music 5", PLAY_MUSIC(song_happy_birthday,buzzer); ) CASE('l', "Light ", ledBand.StopRotation(); ledBand.ResetColor(); ledBand.InsertColorNtimes(3,BLUE,20.0);