Vinícius Alves
/
MenuLCD_copy
Então PARA...
main.cpp@0:92357d1220f3, 2017-05-19 (annotated)
- Committer:
- ViniR
- Date:
- Fri May 19 13:07:52 2017 +0000
- Revision:
- 0:92357d1220f3
Ent?o PARA...
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ViniR | 0:92357d1220f3 | 1 | #include "mbed.h" |
ViniR | 0:92357d1220f3 | 2 | #include "menbed.h" |
ViniR | 0:92357d1220f3 | 3 | #include "TextLCD.h" |
ViniR | 0:92357d1220f3 | 4 | #include "Adafruit_ST7735.h" |
ViniR | 0:92357d1220f3 | 5 | |
ViniR | 0:92357d1220f3 | 6 | Serial pc(USBTX, USBRX); |
ViniR | 0:92357d1220f3 | 7 | DigitalIn enable(D2); |
ViniR | 0:92357d1220f3 | 8 | //float photocellVoltage(void) {return 0;} |
ViniR | 0:92357d1220f3 | 9 | |
ViniR | 0:92357d1220f3 | 10 | Adafruit_ST7735 tft(D11, D12, D13, D10, D8, D9); // MOSI, MISO, SCLK, SSEL, TFT_DC, TFT_RST |
ViniR | 0:92357d1220f3 | 11 | |
ViniR | 0:92357d1220f3 | 12 | void testlines(uint16_t color); |
ViniR | 0:92357d1220f3 | 13 | void testfastlines(uint16_t color1, uint16_t color2); |
ViniR | 0:92357d1220f3 | 14 | void IniciandoMaquina(void); |
ViniR | 0:92357d1220f3 | 15 | void Alerta(void); |
ViniR | 0:92357d1220f3 | 16 | void MenuPrincipal(void); |
ViniR | 0:92357d1220f3 | 17 | void Aguarde(void); |
ViniR | 0:92357d1220f3 | 18 | void Executando(void); |
ViniR | 0:92357d1220f3 | 19 | |
ViniR | 0:92357d1220f3 | 20 | //Serial pc(USBTX, USBRX); // tx, rx |
ViniR | 0:92357d1220f3 | 21 | //I2C i2c_lcd(D14,D15); // SDA, SCL |
ViniR | 0:92357d1220f3 | 22 | //TextLCD_I2C lcd(&i2c_lcd, 0x7E, TextLCD::LCD20x4); // I2C exp: I2C bus, PCF8574 Slaveaddress, LCD Type |
ViniR | 0:92357d1220f3 | 23 | |
ViniR | 0:92357d1220f3 | 24 | int main() { |
ViniR | 0:92357d1220f3 | 25 | |
ViniR | 0:92357d1220f3 | 26 | // Use this initializer if you're using a 1.8" TFT |
ViniR | 0:92357d1220f3 | 27 | tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab |
ViniR | 0:92357d1220f3 | 28 | |
ViniR | 0:92357d1220f3 | 29 | //iniciando máquina |
ViniR | 0:92357d1220f3 | 30 | IniciandoMaquina(); |
ViniR | 0:92357d1220f3 | 31 | wait_ms(5000); |
ViniR | 0:92357d1220f3 | 32 | Alerta(); |
ViniR | 0:92357d1220f3 | 33 | wait_ms(5000); |
ViniR | 0:92357d1220f3 | 34 | MenuPrincipal(); |
ViniR | 0:92357d1220f3 | 35 | wait_ms(5000); |
ViniR | 0:92357d1220f3 | 36 | Aguarde(); |
ViniR | 0:92357d1220f3 | 37 | wait_ms(5000); |
ViniR | 0:92357d1220f3 | 38 | Executando(); |
ViniR | 0:92357d1220f3 | 39 | wait_ms(5000); |
ViniR | 0:92357d1220f3 | 40 | //InicioProcessoReferenciamento(); |
ViniR | 0:92357d1220f3 | 41 | //wait_ms(5000); |
ViniR | 0:92357d1220f3 | 42 | |
ViniR | 0:92357d1220f3 | 43 | |
ViniR | 0:92357d1220f3 | 44 | //lcd.setBacklight(TextLCD::LightOn); |
ViniR | 0:92357d1220f3 | 45 | |
ViniR | 0:92357d1220f3 | 46 | // Declare all the submenus so that they can be referenced in the |
ViniR | 0:92357d1220f3 | 47 | // definitions of other menus |
ViniR | 0:92357d1220f3 | 48 | MenbedMenu *rootMenu; |
ViniR | 0:92357d1220f3 | 49 | MenbedMenu *measurementMenu; |
ViniR | 0:92357d1220f3 | 50 | MenbedMenu *controlMenu; |
ViniR | 0:92357d1220f3 | 51 | MenbedMenu *aboutMenu; |
ViniR | 0:92357d1220f3 | 52 | |
ViniR | 0:92357d1220f3 | 53 | // Root menu--to create a menu, we first create an array of pointers to |
ViniR | 0:92357d1220f3 | 54 | // all the menu items that will populate the menu. The MenbedMenuItem |
ViniR | 0:92357d1220f3 | 55 | // constructor take five arguments: the function to be executed when the |
ViniR | 0:92357d1220f3 | 56 | // item is selected; the child menu to open when the item is selected; |
ViniR | 0:92357d1220f3 | 57 | // a boolean indicating whether the child menu is actually this menu's |
ViniR | 0:92357d1220f3 | 58 | // ancestor, (useful when creating "go to root menu" items); a parameter |
ViniR | 0:92357d1220f3 | 59 | // object that holds a value to be viewed or modified; and a text string |
ViniR | 0:92357d1220f3 | 60 | // indicating what the menu item should say. The text string may contain |
ViniR | 0:92357d1220f3 | 61 | // a printf-style specifier for a float that is bracketed by \t characters |
ViniR | 0:92357d1220f3 | 62 | // to offset it from the surrounding text. If the float specified is |
ViniR | 0:92357d1220f3 | 63 | // found, it will be replaced by the value of the parameter. |
ViniR | 0:92357d1220f3 | 64 | MenbedMenuItem *rootMenuItems[5] = { |
ViniR | 0:92357d1220f3 | 65 | new MenbedMenuItem (NULL, &measurementMenu, false, NULL, "Controle Manual"), // function,child,bollean,data,text |
ViniR | 0:92357d1220f3 | 66 | new MenbedMenuItem (NULL, &controlMenu, false, NULL, "Arquivos"), |
ViniR | 0:92357d1220f3 | 67 | new MenbedMenuItem (NULL, &aboutMenu, false, NULL, "Configuracoes"), |
ViniR | 0:92357d1220f3 | 68 | new MenbedMenuItem (NULL, &rootMenu, false, NULL, "Referenciamento"), |
ViniR | 0:92357d1220f3 | 69 | new MenbedMenuItem (NULL, &rootMenu, false, NULL, "Capacitivo"), |
ViniR | 0:92357d1220f3 | 70 | }; |
ViniR | 0:92357d1220f3 | 71 | // After we have the array of pointers to menu items, we pass the number of |
ViniR | 0:92357d1220f3 | 72 | // elements in the arry and the array itself to the MenbedMenu constructor. |
ViniR | 0:92357d1220f3 | 73 | rootMenu = new MenbedMenu (5, rootMenuItems); |
ViniR | 0:92357d1220f3 | 74 | |
ViniR | 0:92357d1220f3 | 75 | // Measurements menu--the first item of the measurement menu displays the |
ViniR | 0:92357d1220f3 | 76 | // voltage and the resistor divider junction formed between a photocell and |
ViniR | 0:92357d1220f3 | 77 | // a fixed resistor. To print this voltage as part of a menu item, we |
ViniR | 0:92357d1220f3 | 78 | // create a MenbedMenuParam object that takes as arguments to its |
ViniR | 0:92357d1220f3 | 79 | // constructor: a pointer to a function that returns a float containing the |
ViniR | 0:92357d1220f3 | 80 | // value of the parameter; a pointer to a function that we would call to |
ViniR | 0:92357d1220f3 | 81 | // change the value of the parameter; a boolean (irrevelant here) |
ViniR | 0:92357d1220f3 | 82 | // indicating whether the parameter, if it were modifiable by the user, |
ViniR | 0:92357d1220f3 | 83 | // should be updated as the user is changing its value or whether its |
ViniR | 0:92357d1220f3 | 84 | // should only be updated after the user has confirmed the new value; a |
ViniR | 0:92357d1220f3 | 85 | // minimum value for the parameter; a maximum value; and a step size. |
ViniR | 0:92357d1220f3 | 86 | //MenbedMenuParam photocellParam (photocellVoltage, NULL, false, 0.0, 0.0, 0.0); |
ViniR | 0:92357d1220f3 | 87 | |
ViniR | 0:92357d1220f3 | 88 | // Having created the parameter, we pass it as the 4th argument of the |
ViniR | 0:92357d1220f3 | 89 | // MenbedMenuItem constructor. Note the \t-offset %.2f format specified |
ViniR | 0:92357d1220f3 | 90 | // in the menu item text. The menu system will call the photocellVoltage |
ViniR | 0:92357d1220f3 | 91 | // function specified in the parameter constructor above and then print the |
ViniR | 0:92357d1220f3 | 92 | // float that it returns in place of the %.2f in the menu text. |
ViniR | 0:92357d1220f3 | 93 | |
ViniR | 0:92357d1220f3 | 94 | MenbedMenuItem *measurementMenuItems[2] = { |
ViniR | 0:92357d1220f3 | 95 | //new MenbedMenuItem (NULL, NULL, false, &photocellParam, "Photocell: \t%.2f\tV"), |
ViniR | 0:92357d1220f3 | 96 | new MenbedMenuItem (NULL, &rootMenu, true, NULL, "lee") }; |
ViniR | 0:92357d1220f3 | 97 | measurementMenu = new MenbedMenu (2, measurementMenuItems); |
ViniR | 0:92357d1220f3 | 98 | |
ViniR | 0:92357d1220f3 | 99 | // Controls menu--We have modifiable parameters in the first and second |
ViniR | 0:92357d1220f3 | 100 | // meu items of the controls menu. Walking through the first parameter |
ViniR | 0:92357d1220f3 | 101 | // constructor, the getLed1Pwm function pointer points to a function that |
ViniR | 0:92357d1220f3 | 102 | // returns the current value of the PWM duty cycle. The setLed1Pwm |
ViniR | 0:92357d1220f3 | 103 | // function pointer points to a function which sets the PWM duty cycle. |
ViniR | 0:92357d1220f3 | 104 | // The boolean set to true indicates that as soon as the user makes a |
ViniR | 0:92357d1220f3 | 105 | // change to the parameter, the setLed1Pwm function will be called. The |
ViniR | 0:92357d1220f3 | 106 | // menu system will not wait for the user to confirm his change before |
ViniR | 0:92357d1220f3 | 107 | // making the call. The 0.0 and 100.0 represent the minimum and |
ViniR | 0:92357d1220f3 | 108 | // maximum PWM values. The final 1.0 paramter is the step size when |
ViniR | 0:92357d1220f3 | 109 | // changing the PWM duty cycle. |
ViniR | 0:92357d1220f3 | 110 | // MenbedMenuParam pwmParam1 (getLed1Pwm, setLed1Pwm, true, 0.0, 100.0, 1.0); |
ViniR | 0:92357d1220f3 | 111 | // The only different in this parameter from the one above is that the PWM |
ViniR | 0:92357d1220f3 | 112 | // duty cycle is not updated (setLed2Pwm is not called) until the user |
ViniR | 0:92357d1220f3 | 113 | // confirms the new duty cycle. If the user cancels his modifications |
ViniR | 0:92357d1220f3 | 114 | // (either by pushing the cancel button or pushing and holding the select |
ViniR | 0:92357d1220f3 | 115 | // button) setLed2PWM is never called. |
ViniR | 0:92357d1220f3 | 116 | // MenbedMenuParam pwmParam2 (getLed2Pwm, setLed2Pwm, false, 0.0, 100.0, 1.0); |
ViniR | 0:92357d1220f3 | 117 | // The third, fourth, and fifth items of the control menu demonstrate |
ViniR | 0:92357d1220f3 | 118 | // functions when a menu item is selected. The ability to call a function |
ViniR | 0:92357d1220f3 | 119 | // can be combined with either displaying a submenu or editing a parameter. |
ViniR | 0:92357d1220f3 | 120 | MenbedMenuItem *controlMenuItems[6] = { |
ViniR | 0:92357d1220f3 | 121 | // new MenbedMenuItem (NULL, NULL, false, &pwmParam1, "LED1 PWM: \t%.0f\t%"), |
ViniR | 0:92357d1220f3 | 122 | // new MenbedMenuItem (NULL, NULL, false, &pwmParam2, "LED2 PWM: \t%.0f\t%"), |
ViniR | 0:92357d1220f3 | 123 | // new MenbedMenuItem (toggleLed3, NULL, false, NULL, "Toggle LED3"), |
ViniR | 0:92357d1220f3 | 124 | // new MenbedMenuItem (lightLed4, NULL, false, NULL, "Light LED4"), |
ViniR | 0:92357d1220f3 | 125 | // new MenbedMenuItem (extinguishLed4, NULL, false, NULL, "Extinguish LED4"), |
ViniR | 0:92357d1220f3 | 126 | new MenbedMenuItem (NULL, &rootMenu, true, NULL, "Home") }; |
ViniR | 0:92357d1220f3 | 127 | controlMenu = new MenbedMenu (6, controlMenuItems); |
ViniR | 0:92357d1220f3 | 128 | |
ViniR | 0:92357d1220f3 | 129 | // About menu--there's nothing fancy here, but the lack of a "Home" item |
ViniR | 0:92357d1220f3 | 130 | // forces the user to employ the cancel button, either directly or by |
ViniR | 0:92357d1220f3 | 131 | // pushing and hold the select button, to return to the root menu. |
ViniR | 0:92357d1220f3 | 132 | MenbedMenuItem *aboutMenuItems[3] = { |
ViniR | 0:92357d1220f3 | 133 | new MenbedMenuItem (NULL, NULL, false, NULL, " NXP3915"), |
ViniR | 0:92357d1220f3 | 134 | new MenbedMenuItem (NULL, NULL, false, NULL, " Copyright 2011"), |
ViniR | 0:92357d1220f3 | 135 | new MenbedMenuItem (NULL, NULL, false, NULL, " xxxxxxxx@xxx.xxx") }; |
ViniR | 0:92357d1220f3 | 136 | aboutMenu = new MenbedMenu (3, aboutMenuItems); |
ViniR | 0:92357d1220f3 | 137 | |
ViniR | 0:92357d1220f3 | 138 | // Having created the menus, menu items, and item parameters, we are ready |
ViniR | 0:92357d1220f3 | 139 | // to instantiate the display. MenbedDisplayHD44780 extends MenbedDisplay |
ViniR | 0:92357d1220f3 | 140 | // and implements the all-important writeLine function allong with some |
ViniR | 0:92357d1220f3 | 141 | // other less important functions. The pins we pass to the constructor |
ViniR | 0:92357d1220f3 | 142 | // specify the physical interface connection to the LCD. |
ViniR | 0:92357d1220f3 | 143 | MenbedDisplayHD44780 *hd44780Lcd = new MenbedDisplayHD44780 |
ViniR | 0:92357d1220f3 | 144 | (D8, D9, D4, D5, D6, D7, MenbedDisplayHD44780::LCD20x4); |
ViniR | 0:92357d1220f3 | 145 | |
ViniR | 0:92357d1220f3 | 146 | // Now, we have the menu objects and the display object. All we have to do |
ViniR | 0:92357d1220f3 | 147 | // is create the menbed menu system. The number of buttons used by the |
ViniR | 0:92357d1220f3 | 148 | // menu system is specified by the number of pins passed to the Menbed |
ViniR | 0:92357d1220f3 | 149 | // constructor. The pin order is select, down, up, cancel. With |
ViniR | 0:92357d1220f3 | 150 | // constructor overloading, we can opt out of using the cancel and up |
ViniR | 0:92357d1220f3 | 151 | // buttons. |
ViniR | 0:92357d1220f3 | 152 | |
ViniR | 0:92357d1220f3 | 153 | /* Four buttons (select, down, up, cancel ) */ |
ViniR | 0:92357d1220f3 | 154 | Menbed menbed(D10, D11, D12, D13, |
ViniR | 0:92357d1220f3 | 155 | rootMenu, |
ViniR | 0:92357d1220f3 | 156 | hd44780Lcd); |
ViniR | 0:92357d1220f3 | 157 | } |
ViniR | 0:92357d1220f3 | 158 | |
ViniR | 0:92357d1220f3 | 159 | void testlines(uint16_t color) |
ViniR | 0:92357d1220f3 | 160 | { |
ViniR | 0:92357d1220f3 | 161 | tft.fillScreen(ST7735_BLACK); |
ViniR | 0:92357d1220f3 | 162 | for (int16_t x=0; x < tft.width(); x+=6) { |
ViniR | 0:92357d1220f3 | 163 | tft.drawLine(0, 0, x, tft.height()-1, color); |
ViniR | 0:92357d1220f3 | 164 | } |
ViniR | 0:92357d1220f3 | 165 | for (int16_t y=0; y < tft.height(); y+=6) { |
ViniR | 0:92357d1220f3 | 166 | tft.drawLine(0, 0, tft.width()-1, y, color); |
ViniR | 0:92357d1220f3 | 167 | } |
ViniR | 0:92357d1220f3 | 168 | |
ViniR | 0:92357d1220f3 | 169 | tft.fillScreen(ST7735_BLACK); |
ViniR | 0:92357d1220f3 | 170 | for (int16_t x=0; x < tft.width(); x+=6) { |
ViniR | 0:92357d1220f3 | 171 | tft.drawLine(tft.width()-1, 0, x, tft.height()-1, color); |
ViniR | 0:92357d1220f3 | 172 | } |
ViniR | 0:92357d1220f3 | 173 | for (int16_t y=0; y < tft.height(); y+=6) { |
ViniR | 0:92357d1220f3 | 174 | tft.drawLine(tft.width()-1, 0, 0, y, color); |
ViniR | 0:92357d1220f3 | 175 | } |
ViniR | 0:92357d1220f3 | 176 | |
ViniR | 0:92357d1220f3 | 177 | tft.fillScreen(ST7735_BLACK); |
ViniR | 0:92357d1220f3 | 178 | for (int16_t x=0; x < tft.width(); x+=6) { |
ViniR | 0:92357d1220f3 | 179 | tft.drawLine(0, tft.height()-1, x, 0, color); |
ViniR | 0:92357d1220f3 | 180 | } |
ViniR | 0:92357d1220f3 | 181 | for (int16_t y=0; y < tft.height(); y+=6) { |
ViniR | 0:92357d1220f3 | 182 | tft.drawLine(0, tft.height()-1, tft.width()-1, y, color); |
ViniR | 0:92357d1220f3 | 183 | } |
ViniR | 0:92357d1220f3 | 184 | |
ViniR | 0:92357d1220f3 | 185 | tft.fillScreen(ST7735_BLACK); |
ViniR | 0:92357d1220f3 | 186 | for (int16_t x=0; x < tft.width(); x+=6) { |
ViniR | 0:92357d1220f3 | 187 | tft.drawLine(tft.width()-1, tft.height()-1, x, 0, color); |
ViniR | 0:92357d1220f3 | 188 | } |
ViniR | 0:92357d1220f3 | 189 | for (int16_t y=0; y < tft.height(); y+=6) { |
ViniR | 0:92357d1220f3 | 190 | tft.drawLine(tft.width()-1, tft.height()-1, 0, y, color); |
ViniR | 0:92357d1220f3 | 191 | } |
ViniR | 0:92357d1220f3 | 192 | } |
ViniR | 0:92357d1220f3 | 193 | |
ViniR | 0:92357d1220f3 | 194 | void testfastlines(uint16_t color1, uint16_t color2) |
ViniR | 0:92357d1220f3 | 195 | { |
ViniR | 0:92357d1220f3 | 196 | tft.fillScreen(ST7735_BLACK); |
ViniR | 0:92357d1220f3 | 197 | for (int16_t y=0; y < tft.height(); y+=5) { |
ViniR | 0:92357d1220f3 | 198 | tft.drawFastHLine(0, y, tft.width(), color1); |
ViniR | 0:92357d1220f3 | 199 | } |
ViniR | 0:92357d1220f3 | 200 | for (int16_t x=0; x < tft.width(); x+=5) { |
ViniR | 0:92357d1220f3 | 201 | tft.drawFastVLine(x, 0, tft.height(), color2); |
ViniR | 0:92357d1220f3 | 202 | } |
ViniR | 0:92357d1220f3 | 203 | } |
ViniR | 0:92357d1220f3 | 204 | |
ViniR | 0:92357d1220f3 | 205 | |
ViniR | 0:92357d1220f3 | 206 | |
ViniR | 0:92357d1220f3 | 207 | void IniciandoMaquina() |
ViniR | 0:92357d1220f3 | 208 | { |
ViniR | 0:92357d1220f3 | 209 | tft.setTextWrap(true); |
ViniR | 0:92357d1220f3 | 210 | tft.fillScreen(ST7735_BLACK); |
ViniR | 0:92357d1220f3 | 211 | int x = 0; |
ViniR | 0:92357d1220f3 | 212 | while(x < 5) { |
ViniR | 0:92357d1220f3 | 213 | tft.fillScreen(ST7735_BLACK); |
ViniR | 0:92357d1220f3 | 214 | tft.setCursor(0,50); |
ViniR | 0:92357d1220f3 | 215 | tft.setTextColor(ST7735_WHITE); |
ViniR | 0:92357d1220f3 | 216 | tft.setTextSize(2); |
ViniR | 0:92357d1220f3 | 217 | tft.printf("Iniciando Pet-Finder"); |
ViniR | 0:92357d1220f3 | 218 | tft.setCursor(0,100); |
ViniR | 0:92357d1220f3 | 219 | tft.printf("Aguarde"); |
ViniR | 0:92357d1220f3 | 220 | wait_ms(100); |
ViniR | 0:92357d1220f3 | 221 | tft.fillScreen(ST7735_BLACK); |
ViniR | 0:92357d1220f3 | 222 | tft.setCursor(0,50); |
ViniR | 0:92357d1220f3 | 223 | tft.setTextColor(ST7735_WHITE); |
ViniR | 0:92357d1220f3 | 224 | tft.setTextSize(2); |
ViniR | 0:92357d1220f3 | 225 | tft.printf("Iniciando Pet-Finder"); |
ViniR | 0:92357d1220f3 | 226 | tft.setCursor(0,100); |
ViniR | 0:92357d1220f3 | 227 | tft.printf("Aguarde..."); |
ViniR | 0:92357d1220f3 | 228 | wait_ms(100); |
ViniR | 0:92357d1220f3 | 229 | x += 1; |
ViniR | 0:92357d1220f3 | 230 | } |
ViniR | 0:92357d1220f3 | 231 | } |
ViniR | 0:92357d1220f3 | 232 | |
ViniR | 0:92357d1220f3 | 233 | |
ViniR | 0:92357d1220f3 | 234 | |
ViniR | 0:92357d1220f3 | 235 | void Alerta() { |
ViniR | 0:92357d1220f3 | 236 | tft.setTextWrap(true); |
ViniR | 0:92357d1220f3 | 237 | int x = 0; |
ViniR | 0:92357d1220f3 | 238 | while(x < 10) { |
ViniR | 0:92357d1220f3 | 239 | tft.fillScreen(ST7735_BLACK); |
ViniR | 0:92357d1220f3 | 240 | tft.setCursor(0,50); |
ViniR | 0:92357d1220f3 | 241 | tft.setTextColor(ST7735_WHITE); |
ViniR | 0:92357d1220f3 | 242 | tft.setTextSize(2); |
ViniR | 0:92357d1220f3 | 243 | tft.printf("!!ALERTA!!"); |
ViniR | 0:92357d1220f3 | 244 | wait_ms(200); |
ViniR | 0:92357d1220f3 | 245 | tft.fillScreen(ST7735_RED); |
ViniR | 0:92357d1220f3 | 246 | tft.setTextSize(2); |
ViniR | 0:92357d1220f3 | 247 | tft.printf("!!ALERTA!!"); |
ViniR | 0:92357d1220f3 | 248 | wait_ms(300); |
ViniR | 0:92357d1220f3 | 249 | x += 1; |
ViniR | 0:92357d1220f3 | 250 | } |
ViniR | 0:92357d1220f3 | 251 | |
ViniR | 0:92357d1220f3 | 252 | } |
ViniR | 0:92357d1220f3 | 253 | |
ViniR | 0:92357d1220f3 | 254 | void MenuPrincipal() { |
ViniR | 0:92357d1220f3 | 255 | tft.fillScreen(ST7735_BLACK); |
ViniR | 0:92357d1220f3 | 256 | tft.setCursor(0,0); |
ViniR | 0:92357d1220f3 | 257 | tft.setTextColor(ST7735_WHITE); |
ViniR | 0:92357d1220f3 | 258 | tft.setTextSize(2); |
ViniR | 0:92357d1220f3 | 259 | tft.printf("Pet-Finder"); |
ViniR | 0:92357d1220f3 | 260 | tft.setCursor(0,40); |
ViniR | 0:92357d1220f3 | 261 | tft.printf("Data:"); |
ViniR | 0:92357d1220f3 | 262 | tft.setCursor(0,55); |
ViniR | 0:92357d1220f3 | 263 | tft.printf("15/05/2017"); |
ViniR | 0:92357d1220f3 | 264 | tft.setCursor(0,80); |
ViniR | 0:92357d1220f3 | 265 | tft.printf("Horario:"); |
ViniR | 0:92357d1220f3 | 266 | tft.setCursor(0,95); |
ViniR | 0:92357d1220f3 | 267 | tft.printf("17h27"); |
ViniR | 0:92357d1220f3 | 268 | wait_ms(200); |
ViniR | 0:92357d1220f3 | 269 | |
ViniR | 0:92357d1220f3 | 270 | } |
ViniR | 0:92357d1220f3 | 271 | |
ViniR | 0:92357d1220f3 | 272 | void Aguarde() { |
ViniR | 0:92357d1220f3 | 273 | int x = 0; |
ViniR | 0:92357d1220f3 | 274 | while(x < 5) { |
ViniR | 0:92357d1220f3 | 275 | tft.fillScreen(ST7735_BLACK); |
ViniR | 0:92357d1220f3 | 276 | tft.setCursor(0,70); |
ViniR | 0:92357d1220f3 | 277 | tft.setTextSize(2); |
ViniR | 0:92357d1220f3 | 278 | tft.printf("Aguarde..."); |
ViniR | 0:92357d1220f3 | 279 | wait_ms(800); |
ViniR | 0:92357d1220f3 | 280 | x += 1; |
ViniR | 0:92357d1220f3 | 281 | } |
ViniR | 0:92357d1220f3 | 282 | } |
ViniR | 0:92357d1220f3 | 283 | |
ViniR | 0:92357d1220f3 | 284 | void Executando() { |
ViniR | 0:92357d1220f3 | 285 | int x = 0; |
ViniR | 0:92357d1220f3 | 286 | tft.fillScreen(ST7735_WHITE); |
ViniR | 0:92357d1220f3 | 287 | tft.setTextColor(ST7735_BLACK); |
ViniR | 0:92357d1220f3 | 288 | while(x < 3) { |
ViniR | 0:92357d1220f3 | 289 | tft.fillScreen(ST7735_GREEN); |
ViniR | 0:92357d1220f3 | 290 | tft.setCursor(0,70); |
ViniR | 0:92357d1220f3 | 291 | tft.setTextSize(2); |
ViniR | 0:92357d1220f3 | 292 | tft.printf("Executando"); |
ViniR | 0:92357d1220f3 | 293 | wait_ms(800); |
ViniR | 0:92357d1220f3 | 294 | tft.fillScreen(ST7735_WHITE); |
ViniR | 0:92357d1220f3 | 295 | tft.setTextColor(ST7735_BLACK); |
ViniR | 0:92357d1220f3 | 296 | tft.setCursor(0,70); |
ViniR | 0:92357d1220f3 | 297 | tft.printf("Executando"); |
ViniR | 0:92357d1220f3 | 298 | wait_ms(400); |
ViniR | 0:92357d1220f3 | 299 | x += 1; |
ViniR | 0:92357d1220f3 | 300 | |
ViniR | 0:92357d1220f3 | 301 | } |
ViniR | 0:92357d1220f3 | 302 | tft.fillScreen(ST7735_GREEN); |
ViniR | 0:92357d1220f3 | 303 | tft.setCursor(0,70); |
ViniR | 0:92357d1220f3 | 304 | tft.printf("Executando"); |
ViniR | 0:92357d1220f3 | 305 | } |
ViniR | 0:92357d1220f3 | 306 | |
ViniR | 0:92357d1220f3 | 307 | |
ViniR | 0:92357d1220f3 | 308 | // ---------------------------------------------------------------------------------------------------------------- |
ViniR | 0:92357d1220f3 | 309 | |
ViniR | 0:92357d1220f3 | 310 | |
ViniR | 0:92357d1220f3 | 311 |