For Pet_Finder
Dependencies: Adafruit_GFX Adafruit_ST7735 Adafruit_TFT_Shieldv1_graphicstest SDFileSystem mbed
Fork of Adafruit_TFT_Shieldv1_graphicstest by
main.cpp
- Committer:
- GabrielGoichman
- Date:
- 2017-05-16
- Revision:
- 2:e64c231f0abb
- Parent:
- 0:b0981712db9b
- Child:
- 4:41b8a8713b49
File content as of revision 2:e64c231f0abb:
#include "mbed.h" #include "Adafruit_ST7735.h" Adafruit_ST7735 tft(D11, D12, D13, D10, D8, D9); // MOSI, MISO, SCLK, SSEL, TFT_DC, TFT_RST void testlines(uint16_t color); void testfastlines(uint16_t color1, uint16_t color2); void IniciandoMaquina(void); void Alerta(void); void MenuPrincipal(void); void Aguarde(void); void Executando(void); int main(void) { // Use this initializer if you're using a 1.8" TFT tft.initR(INITR_BLACKTAB); // initialize a ST7735S chip, black tab //iniciando máquina IniciandoMaquina(); wait_ms(5000); Alerta(); wait_ms(5000); MenuPrincipal(); wait_ms(5000); Aguarde(); wait_ms(5000); Executando(); wait_ms(5000); //InicioProcessoReferenciamento(); //wait_ms(5000); } // ---------------------------------------------------------------------------------------------------------------- void testlines(uint16_t color) { tft.fillScreen(ST7735_BLACK); for (int16_t x=0; x < tft.width(); x+=6) { tft.drawLine(0, 0, x, tft.height()-1, color); } for (int16_t y=0; y < tft.height(); y+=6) { tft.drawLine(0, 0, tft.width()-1, y, color); } tft.fillScreen(ST7735_BLACK); for (int16_t x=0; x < tft.width(); x+=6) { tft.drawLine(tft.width()-1, 0, x, tft.height()-1, color); } for (int16_t y=0; y < tft.height(); y+=6) { tft.drawLine(tft.width()-1, 0, 0, y, color); } tft.fillScreen(ST7735_BLACK); for (int16_t x=0; x < tft.width(); x+=6) { tft.drawLine(0, tft.height()-1, x, 0, color); } for (int16_t y=0; y < tft.height(); y+=6) { tft.drawLine(0, tft.height()-1, tft.width()-1, y, color); } tft.fillScreen(ST7735_BLACK); for (int16_t x=0; x < tft.width(); x+=6) { tft.drawLine(tft.width()-1, tft.height()-1, x, 0, color); } for (int16_t y=0; y < tft.height(); y+=6) { tft.drawLine(tft.width()-1, tft.height()-1, 0, y, color); } } void testfastlines(uint16_t color1, uint16_t color2) { tft.fillScreen(ST7735_BLACK); for (int16_t y=0; y < tft.height(); y+=5) { tft.drawFastHLine(0, y, tft.width(), color1); } for (int16_t x=0; x < tft.width(); x+=5) { tft.drawFastVLine(x, 0, tft.height(), color2); } } void IniciandoMaquina() { tft.setTextWrap(true); tft.fillScreen(ST7735_BLACK); int x = 0; while(x < 5) { tft.fillScreen(ST7735_BLACK); tft.setCursor(0,50); tft.setTextColor(ST7735_WHITE); tft.setTextSize(2); tft.printf("Iniciando Pet-Finder"); tft.setCursor(0,100); tft.printf("Aguarde"); wait_ms(100); tft.fillScreen(ST7735_BLACK); tft.setCursor(0,50); tft.setTextColor(ST7735_WHITE); tft.setTextSize(2); tft.printf("Iniciando Pet-Finder"); tft.setCursor(0,100); tft.printf("Aguarde..."); wait_ms(100); x += 1; } } void Alerta() { tft.setTextWrap(true); int x = 0; while(x < 10) { tft.fillScreen(ST7735_BLACK); tft.setCursor(0,50); tft.setTextColor(ST7735_WHITE); tft.setTextSize(2); tft.printf("!!ALERTA!!"); wait_ms(200); tft.fillScreen(ST7735_RED); tft.setTextSize(2); tft.printf("!!ALERTA!!"); wait_ms(300); x += 1; } } void MenuPrincipal() { tft.fillScreen(ST7735_BLACK); tft.setCursor(0,0); tft.setTextColor(ST7735_WHITE); tft.setTextSize(2); tft.printf("Pet-Finder"); tft.setCursor(0,40); tft.printf("Data:"); tft.setCursor(0,55); tft.printf("15/05/2017"); tft.setCursor(0,80); tft.printf("Horario:"); tft.setCursor(0,95); tft.printf("17h27"); wait_ms(200); } void Aguarde() { int x = 0; while(x < 5) { tft.fillScreen(ST7735_BLACK); tft.setCursor(0,70); tft.setTextSize(2); tft.printf("Aguarde..."); wait_ms(800); x += 1; } } void Executando() { int x = 0; tft.fillScreen(ST7735_WHITE); tft.setTextColor(ST7735_BLACK); while(x < 3) { tft.fillScreen(ST7735_GREEN); tft.setCursor(0,70); tft.setTextSize(2); tft.printf("Executando"); wait_ms(800); tft.fillScreen(ST7735_WHITE); tft.setTextColor(ST7735_BLACK); tft.setCursor(0,70); tft.printf("Executando"); wait_ms(400); x += 1; } tft.fillScreen(ST7735_GREEN); tft.setCursor(0,70); tft.printf("Executando"); } // ----------------------------------------------------------------------------------------------------------------