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.
Dependencies: TS_DISCO_F746NG mbed LCD_DISCO_F746NG BSP_DISCO_F746NG MCP9808 BUTTON_GROUP
Revision 4:201e97957618, committed 2015-12-09
- Comitter:
- MikamiUitOpen
- Date:
- Wed Dec 09 01:55:57 2015 +0000
- Parent:
- 3:edc98882d63a
- Child:
- 5:ab0913c1557a
- Commit message:
- 5
Changed in this revision
| BUTTON_GROUP.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/BUTTON_GROUP.lib Tue Dec 08 14:20:25 2015 +0000 +++ b/BUTTON_GROUP.lib Wed Dec 09 01:55:57 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/MikamiUitOpen/code/BUTTON_GROUP/#2cc388e91bde +http://mbed.org/users/MikamiUitOpen/code/BUTTON_GROUP/#d268555e2f50
--- 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);