this locks like shit

Dependencies:   MenuLCD mbed

Fork of MenuLCD_copy by Vinícius Alves

Files at this revision

API Documentation at this revision

Comitter:
LucasMatBorges
Date:
Fri May 19 18:48:04 2017 +0000
Parent:
0:92357d1220f3
Commit message:
R?row mein

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Fri May 19 13:07:52 2017 +0000
+++ b/main.cpp	Fri May 19 18:48:04 2017 +0000
@@ -1,46 +1,20 @@
 #include "mbed.h"
 #include "menbed.h"
 #include "TextLCD.h"
-#include "Adafruit_ST7735.h"
 
 Serial pc(USBTX, USBRX);
-DigitalIn enable(D2);
-//float photocellVoltage(void) {return 0;}
-
-Adafruit_ST7735 tft(D11, D12, D13, D10, D8, D9); // MOSI, MISO, SCLK, SSEL, TFT_DC, TFT_RST
+DigitalOut myled(D14);
+void capacitivo(){
+        myled=!myled;
+        }
 
-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);
+//float photocellVoltage(void) {return 0;}
 
 //Serial pc(USBTX, USBRX); // tx, rx
 //I2C i2c_lcd(D14,D15); // SDA, SCL
 //TextLCD_I2C lcd(&i2c_lcd, 0x7E, TextLCD::LCD20x4);                  // I2C exp: I2C bus, PCF8574 Slaveaddress, LCD Type
 
 int main() {
-    
-    // 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);
-    
-
 //lcd.setBacklight(TextLCD::LightOn);
 
     // Declare all the submenus so that they can be referenced in the
@@ -63,7 +37,7 @@
     // found, it will be replaced by the value of the parameter.
     MenbedMenuItem *rootMenuItems[5] = {
         new MenbedMenuItem (NULL, &measurementMenu, false, NULL, "Controle Manual"), // function,child,bollean,data,text
-        new MenbedMenuItem (NULL, &controlMenu, false, NULL, "Arquivos"),
+        new MenbedMenuItem (capacitivo, &controlMenu, false, NULL, "Arquivos"),
         new MenbedMenuItem (NULL, &aboutMenu, false, NULL, "Configuracoes"),
         new MenbedMenuItem (NULL, &rootMenu, false, NULL, "Referenciamento"),
         new MenbedMenuItem (NULL, &rootMenu, false, NULL, "Capacitivo"),
@@ -93,7 +67,8 @@
 
     MenbedMenuItem *measurementMenuItems[2] = {
         //new MenbedMenuItem (NULL, NULL, false, &photocellParam, "Photocell: \t%.2f\tV"),
-        new MenbedMenuItem (NULL, &rootMenu, true, NULL, "lee") };
+        new MenbedMenuItem (NULL, &rootMenu, true, NULL, "lee"),
+        new MenbedMenuItem (capacitivo, NULL, true, NULL, "LED") };
     measurementMenu = new MenbedMenu (2, measurementMenuItems);
 
     // Controls menu--We have modifiable parameters in the first and second
@@ -154,158 +129,7 @@
     Menbed menbed(D10, D11, D12, D13,
         rootMenu,
         hd44780Lcd);
-}
-
-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;
-    }
+while(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");
-}
-
-
-// ----------------------------------------------------------------------------------------------------------------
-
-
-