Programme qui permet de piloter un bandeau de LED ring (de la marque adafruit) en fonction du son qui provient d'un microphone externe. Programme fonctionnant sur un microcontrôleur DISCO-F746NG. Ce projet a était fait dans la cadre du cour d'interface de la Licence MECSE de l'IUT de Cachan.
Dependencies: TS_DISCO_F746NG mbed LCD_DISCO_F746NG BSP_DISCO_F746NG NeoPixel BUTTON_GROUP
test
Diff: main.cpp
- Revision:
- 4:201e97957618
- Parent:
- 3:edc98882d63a
- Child:
- 6:2736b38c1d73
--- a/main.cpp Tue Dec 08 14:20:25 2015 +0000 +++ b/main.cpp Wed Dec 09 01:55:57 2015 +0000 @@ -1,7 +1,7 @@ //--------------------------------------------------------------- // Demo program of Button class and ButtonGroup class // -// 2015/12/05, Copyright (c) 2015 MIKAMI, Naoki +// 2015/12/09, Copyright (c) 2015 MIKAMI, Naoki //--------------------------------------------------------------- #include "button_group.hpp" @@ -13,10 +13,9 @@ int main() { - printf("\r\n23:13"); const int Y0 = 5; - const int X1 = 50; - const int Y1 = 200; + const int X1 = 30; + const int Y1 = 100; uint32_t backColor = 0xFF006A6C; // teal green uint32_t inActive = backColor & 0xE0FFFFFF; // color for inactive button @@ -27,7 +26,11 @@ ButtonGroup bGroup(lcd_, ts_, 10, Y0, 66, 40, LCD_COLOR_BLUE, backColor, NUMBER_BUTTONS, STR, 5, 5, 3); - Button Large(lcd_, ts_, 200, 100, 120, 60, + const string STR_SW[2] = {"ON", "OFF"}; + ButtonGroup sw(lcd_, ts_, 10, 160, 66, 40, + LCD_COLOR_GREEN, backColor, 2, STR_SW, 5, 0, 2); + + Button Large(lcd_, ts_, 280, 100, 120, 60, LCD_COLOR_GREEN, backColor, "LARGE", Font24); Button reset(lcd_, ts_, 410, Y0, 60, 40, @@ -49,6 +52,11 @@ reset.Redraw(); } + if (sw.Touched(0, LCD_COLOR_DARKGREEN)) + lcd_.DisplayStringAt(X1, 210, (uint8_t *)"ON ", LEFT_MODE); + if (sw.Touched(1, LCD_COLOR_DARKGREEN)) + lcd_.DisplayStringAt(X1, 210, (uint8_t *)"OFF", LEFT_MODE); + if (reset.Touched()) { bGroup.Redraw(num);