![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
programme capteur d'empreinte digital
main.cpp
- Committer:
- MikamiUitOpen
- Date:
- 2016-04-08
- Revision:
- 2:b60c218a2432
- Parent:
- 1:b4bcb6fa2a1d
- Child:
- 3:e92615be71c7
File content as of revision 2:b60c218a2432:
//-------------------------------------------------------------------------------- // GuiBase とその派生クラスのデモプログラム // Demo program for GuiBase class and its derivertive classes // // GuiBase, Button, ButtonGroup, Label, NumericLabel, BlimkButton, SeekBar // // 2016/04/08, Copyright (c) 2016 MIKAMI, Naoki //-------------------------------------------------------------------------------- #include "NumericLabel.hpp" #include "BlinkLabel.hpp" #include "ButtonGroup.hpp" #include "SeekBar.hpp" using namespace Mikami; Ticker timer; NumericLabel<float> obj2(10, 150, Label::LEFT, Font16, LCD_COLOR_YELLOW); void TimerIsr() { static int sec = 0; obj2.Draw("%6.1f [s]", (float)(sec++)/10.0f); } int main() { Label obj10(240, 4, "Dome: GUI parts", Label::CENTER, Font16); Label obj11(240, 24, "Label, NumericLabel, BlinkLabel, Button, ButtonGroup, SeekBar", Label::CENTER); Button button1(10, 50, 50, 40, "1"); Button button2(62, 50, 50, 40, "2"); const int NUMBER_BUTTONS = 4; const string STR1[NUMBER_BUTTONS] = {"Button1", "Button2", "Button3", "Button4"}; ButtonGroup bGroup1(160, 50, 66, 40, NUMBER_BUTTONS, STR1, 5, 5, 3, 1, Font12, LCD_COLOR_WHITE, 0xFF003538, 0xFFB70068, 0xFFFF7FFF); NumericLabel<int> bTouch(234, 108, Label::LEFT, Font16, LCD_COLOR_MAGENTA); const string STR2[3] = {"0", "1", "2"}; ButtonGroup bGroup2(160, 150, 66, 40, 3, STR2, 5, 5, 3); 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()); 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); timer.attach(&TimerIsr, 0.1f); while (true) { if (button1.Touched()) button2.Draw(); if (button2.Touched()) button1.Draw(); int num; if (bGroup1.GetTouchedNumber(num)) bTouch.Draw("Button%d touched", num+1); if (bGroup2.GetTouchedNumber(num)) switch (num) { case 0: button1.Activate(); bGroup1.Activate(1); bGroup1.DrawAll(); break; case 1: button1.Inactivate(); bGroup1.Inactivate(1); break; case 2: for (int n=0; n<4; n++) bGroup1.Erase(n); break; } if (bar.Slide()) { numLabel1.Draw("%5.1f", bar.GetValue()); int8_t x = (int8_t)bar.GetValue(); numLabel2.Draw("%3d", x); numLabel3.Draw("%3d", bar.GetIntValue()); } if (bar2.Slide()) { numLabel4.Draw("%4.1f", bar2.GetValue()); } // If "doNotTouch" button touched, trapped into endless loop if (doNotTouch.Touched()) BlinkLabel warning(250, 200, "You must reset", Label::LEFT, Font16); wait(0.02f); } }