fini

Dependencies:   F746_GUI mbed

Revision:
3:e92615be71c7
Parent:
2:b60c218a2432
Child:
4:4f73a3054a67
--- a/main.cpp	Fri Apr 08 09:44:35 2016 +0000
+++ b/main.cpp	Sun Apr 10 09:26:28 2016 +0000
@@ -4,7 +4,7 @@
 //
 //      GuiBase, Button, ButtonGroup, Label, NumericLabel, BlimkButton, SeekBar
 //
-//  2016/04/08, Copyright (c) 2016 MIKAMI, Naoki
+//  2016/04/10, Copyright (c) 2016 MIKAMI, Naoki
 //--------------------------------------------------------------------------------
 
 #include "NumericLabel.hpp"
@@ -15,7 +15,7 @@
 using namespace Mikami;
 
 Ticker timer;
-NumericLabel<float> obj2(10, 150, Label::LEFT, Font16, LCD_COLOR_YELLOW);
+NumericLabel<float> obj2(10, 116, Label::LEFT, Font16, LCD_COLOR_YELLOW);
 
 void TimerIsr()
 {
@@ -38,22 +38,28 @@
                         Font12, LCD_COLOR_WHITE, 0xFF003538, 0xFFB70068, 0xFFFF7FFF);
     NumericLabel<int> bTouch(234, 108, Label::LEFT, Font16, LCD_COLOR_MAGENTA);
 
+    // Control status of bGroup1
     const string STR2[3] = {"0", "1", "2"};
     ButtonGroup bGroup2(160, 150, 66, 40,  3, STR2, 5, 5, 3);
     
+    // Switching buttons to control barH active or inactive
+    const string STR3[3] = {"ON", "OFF"};
+    ButtonGroup bGroup3(10, 150, 66, 40,  2, STR3, 0, 0, 2);
+    bGroup3.TouchedColor(0);
+
     Button doNotTouch(250, 220, 120, 40, "Don't Touch", Font12,
                       GuiBase::ENUM_TEXT, GuiBase::ENUM_BACK,
                       LCD_COLOR_DARKGREEN, LCD_COLOR_RED);
 
     // Using default value for argument (Horisontal)
-    SeekBar bar(20, 240, 200, -5, 5, 0);
-    NumericLabel<float> numLabel1(20, 200, "%5.1f", bar.GetValue());
-    NumericLabel<int> numLabel2(90, 200, "%3d", (int)bar.GetValue());
+    SeekBar barH(20, 240, 200, -5, 5, 0);
+    NumericLabel<float> numLabel1(20, 200, "%5.1f", barH.GetValue());
+    NumericLabel<int> numLabel2(90, 200, "%3d", (int)barH.GetValue());
     NumericLabel<int> numLabel3(120, 200);
     
-    // Vertical
-    SeekBar bar2(440, 100, 150, -5, 5, 2, SeekBar::Vertical, LCD_COLOR_GREEN);
-    NumericLabel<float> numLabel4(440, 70, "%4.1f", bar2.GetValue(), Label::CENTER);
+    // SeekBar (vertical)
+    SeekBar barV(440, 100, 150, -5, 5, 2, SeekBar::Vertical, LCD_COLOR_GREEN);
+    NumericLabel<float> numLabel4(440, 70, "%4.1f", barV.GetValue(), Label::CENTER);
 
     timer.attach(&TimerIsr, 0.1f);
 
@@ -80,20 +86,24 @@
                     break;
         }
 
-        if (bar.Slide())
+        if (barH.Slide())
         {
-            numLabel1.Draw("%5.1f", bar.GetValue());
-            int8_t x = (int8_t)bar.GetValue();
+            numLabel1.Draw("%5.1f", barH.GetValue());
+            int8_t x = (int8_t)barH.GetValue();
             numLabel2.Draw("%3d", x);
 
-            numLabel3.Draw("%3d", bar.GetIntValue());            
+            numLabel3.Draw("%3d", barH.GetIntValue());            
         }        
 
-        if (bar2.Slide()) { numLabel4.Draw("%4.1f", bar2.GetValue()); }
+        if (barV.Slide()) { numLabel4.Draw("%4.1f", barV.GetValue()); }
         
         // If "doNotTouch" button touched, trapped into endless loop
         if (doNotTouch.Touched())
             BlinkLabel warning(250, 200, "You must reset", Label::LEFT, Font16);
+            
+        // SeekBar active inactive switching
+        if (bGroup3.Touched(0)) barH.Activate();
+        if (bGroup3.Touched(1)) barH.Inactivate();
 
         wait(0.02f);
     }