interface PI
Dependencies: mbed LCD_DISCO_F469NI TS_DISCO_F469NI F469_GUI BSP_DISCO_F469NI
main.cpp
- Committer:
- zigdrix
- Date:
- 2019-10-16
- Revision:
- 1:450d80728151
- Parent:
- 0:0a8891401c4f
- Child:
- 2:7002787e2ab1
File content as of revision 1:450d80728151:
#include "mbed.h" #include "stm32469i_discovery.h" #include "TS_DISCO_F469NI.h" #include "LCD_DISCO_F469NI.h" #include "F469_GUI.hpp" #define TIME 0.1 // Time for toggle the LED (seconds) Timeout timeout; // Create the Timeout object DigitalOut led1(LED1, 0); /*DigitalOut led2(LED1, 0); DigitalOut led3(LED1, 0); DigitalOut led4(LED1, 0);*/ int num; void timer_interrupt() { if(num==2) led = !led; // Toggle the LED state timeout.attach(&timer_interrupt, TIME); // Set again the timer timeout for next iterations } int main(){ BSP_LED_Init(DISCO_LED_BLUE); Label obj10(400, 2, "Felipe", Label::CENTER, Font24); //escreve textos Label obj11(400, 40, "Gomes", Label::CENTER, Font24); //escreve textos //Button button1(10, 90, 120, 100, "1"); const int NUMBER_BUTTONS = 3; //Número de botões const string STR1[NUMBER_BUTTONS] = {"ON", "OFF","?"}; //string que vai nos botões //cria botão na tela,(inicio em x, inicio em Y, largura do botão, altura do botão, número de botões // nome do botão,distãncia dos botões em x, distãncia dos botões em y, número de colunas, // número de colunas, número de linhas, fonte do texto, cor do texto, cores dos estados do botão) ButtonGroup bGroup1(30, 90, 150, 150, NUMBER_BUTTONS, STR1, 40, 5, 3, 1, Font24, LCD_COLOR_WHITE, 0xFF003538, 0xFFB70068, 0xFFFF7FFF); //NumericLabel<int> bTouch(600, 112, Label::LEFT, Font12, LCD_COLOR_MAGENTA);//label para numeros Label bTouch(600, 112, Label::LEFT, Font24, LCD_COLOR_MAGENTA); //ButtonGroup bGroup2(160, 150, 66, 40, 3, (string[]){"0", "1", "2"}, 5, 5, 3); //bGroup2.InactivateAll(); //ButtonGroup bGroup3(10, 150, 66, 40, 2, (string[]){"ON", "OFF"}, 0, 0, 2); //bGroup3.TouchedColor(0); //desenha uma barra gráfica horizontal(inicioX, inicioY, Largura, valor mínimo, Valor maximo, valor inicial, //para criar uma barra gráfica vertical utiliza a função barH SeekBar barH(100, 300, 400, 0, 100, 50, "0", "", "100"); NumericLabel<float> numLabel1(250, 270, "%5.1f", barH.GetValue()); NumericLabel<int> numLabel2(250, 320, "%3d", (int)barH.GetValue()); NumericLabel<int> numLabel3(160, 205);//? timeout.attach(&timer_interrupt, TIME); // Set the timer interrupt service rutine (ISR) and the time for the timeout (in seconds) while(true){ if (bGroup1.GetTouchedNumber(num)) if(num==0){ bTouch.Draw("ON"); BSP_LED_On(DISCO_LED_BLUE); led=1; } else if(num==1){ bTouch.Draw("OFF"); BSP_LED_Off(DISCO_LED_BLUE); led=1; } else if(num==2){ bTouch.Draw("TROLADO"); } } }