Igal Salazar / Mbed 2 deprecated Bluepill_Reloj_copy

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
igalsalazars
Date:
Fri Mar 11 00:13:29 2022 +0000
Commit message:
reloj fechador con lcd ;

Changed in this revision

BluePill/PinNames.h Show annotated file Show diff for this revision Revisions of this file
BluePill/SysClockConf.cpp Show annotated file Show diff for this revision Revisions of this file
BluePill/SysClockConf.h Show annotated file Show diff for this revision Revisions of this file
BluePill/stm32f103c8t6.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BluePill/PinNames.h	Fri Mar 11 00:13:29 2022 +0000
@@ -0,0 +1,217 @@
+/* mbed Microcontroller Library
+ *******************************************************************************
+ * Copyright (c) 2014, STMicroelectronics
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *******************************************************************************
+ 
+ */
+#ifndef MBED_PINNAMES_H
+#define MBED_PINNAMES_H
+
+#include "cmsis.h"
+#include "PinNamesTypes.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//UART to AMB8826
+#define TXD1      PA_9
+#define RXD1      PA_10
+#define CTS1      PA_11
+int baudRate = 115200;
+
+//UART to Silicon Labs CP210x
+#define TXD2      PA_2
+#define RXD2      PA_3
+
+//UART to FTDI
+#define TXD3      PB_10
+#define RXD3      PB_11
+
+//I2C
+#define I2C1_SCL  PB_6
+#define I2C1_SDA  PB_7
+
+#define I2C2_SCL  PB_10
+#define I2C2_SDA  PB_11
+
+//SPI
+#define SPI1_MOSI PA_7
+#define SPI1_MISO PA_6
+#define SPI1_SCLK PA_5
+#define SPI1_NSS1 PA_4
+#define SDsel     PA_4
+
+#define SPI2_MOSI PB_15
+#define SPI2_MISO PB_14
+#define SPI2_SCLK PB_13
+#define SPI2_NSS2 PB_12
+
+//CAN
+#define CAN1_RX   PA_11
+#define CAN1_TX   PA_12
+
+//USB   CDC
+#define USB_POS   PA_12
+#define USB_NEG   PA_11
+
+//ADC
+#define Uin       PA_1
+#define Ubatt     PA_0
+
+typedef enum {
+    // Not connected
+    NC = (int)0xFFFFFFFF,
+
+    // Ports
+    PA_0  = 0x00,
+    PA_1  = 0x01,
+    PA_2  = 0x02,
+    PA_3  = 0x03,
+    PA_4  = 0x04,
+    PA_5  = 0x05,
+    PA_6  = 0x06,
+    PA_7  = 0x07,
+    PA_8  = 0x08,
+    PA_9  = 0x09,
+    PA_10 = 0x0A,
+    PA_11 = 0x0B,
+    PA_12 = 0x0C,
+    PA_13 = NC,
+    PA_14 = NC,
+    PA_15 = 0x0F,
+
+    PB_0  = 0x10,
+    PB_1  = 0x11,
+    PB_2  = NC,
+    PB_3  = 0x13,
+    PB_4  = 0x14,
+    PB_5  = 0x15,
+    PB_6  = 0x16,
+    PB_7  = 0x17,
+    PB_8  = 0x18,
+    PB_9  = 0x19,
+    PB_10 = 0x1A,
+    PB_11 = 0x1B,
+    PB_12 = 0x1C,
+    PB_13 = 0x1D,
+    PB_14 = 0x1E,
+    PB_15 = 0x1F,
+
+    PC_0  = NC,
+    PC_1  = NC,
+    PC_2  = NC,
+    PC_3  = NC,
+    PC_4  = NC,
+    PC_5  = NC,
+    PC_6  = NC,
+    PC_7  = NC,
+    PC_8  = NC,
+    PC_9  = NC,
+    PC_10 = NC,
+    PC_11 = NC,
+    PC_12 = NC,
+    PC_13 = 0x2D,
+    PC_14 = 0x2E,
+    PC_15 = 0x2F,
+
+    PD_2  = NC,
+
+    // ADC internal channels
+    ADC_TEMP = 0xF0,
+    ADC_VREF = 0xF1,
+
+    // Arduino connector namings
+    A0          = PA_0,
+    A1          = PA_1,
+    A2          = PA_4,
+    A3          = PB_0,
+    A4          = NC,
+    A5          = NC,
+    D0          = PA_3,
+    D1          = PA_2,
+    D2          = PA_10,
+    D3          = PB_3,
+    D4          = PB_5,
+    D5          = PB_4,
+    D6          = PB_10,
+    D7          = PA_8,
+    D8          = PA_9,
+    D9          = NC,
+    D10         = PB_6,
+    D11         = PA_7,
+    D12         = PA_6,
+    D13         = PA_5,
+    D14         = PB_9,
+    D15         = PB_8,
+
+    // Generic signals namings
+    Red_Led     = NC,
+    Green_Led   = PC_13,
+    Blue_Led    = NC,
+    LED1        = PC_13,
+    LED2        = NC,
+    LED3        = NC,
+    LED4        = NC,
+    USER_BUTTON = NC,    
+    SERIAL_TX   = PA_2,
+    SERIAL_RX   = PA_3,
+    USBTX       = PA_12,
+    USBRX       = PA_11,
+    CANRX       = PB_8,    
+    CANTX       = PB_9,
+    I2C_SCL     = PB_6,
+    I2C_SDA     = PB_7,
+    SPI_MOSI    = PA_7,
+    SPI_MISO    = PA_6,
+    SPI_SCK     = PA_5,
+    SPI_CS      = PA_4,
+    TRACE_SWO   = PB_3,
+    SWO         = PB_3
+} PinName;
+
+/*
+*+----------------------------------------------------------------------------*
+*+
+*+   Powered by
+*+
+*+          T H E     A N T U L I U ' S   T E A M   R&D  Unltd 
+*+
+*+  Research, Development, Systems, Equipment, Support & Spare Parts.
+*+  (C) Copyright 1989-2019, All Rights Reserved            
+*+
+*+  Welcome to The Beaners Proyect Community!                   
+*+----------------------------------------------------------------------------*
+*/ 
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BluePill/SysClockConf.cpp	Fri Mar 11 00:13:29 2022 +0000
@@ -0,0 +1,56 @@
+/*
+  ******************************************************************************
+  * @file    SysClockConf.c
+  * @version 
+  * @date    05-July-2016
+  * @brief   System Clock configuration for STM32F103C8T6
+  *****************************************************************************
+  *
+  * All rights reserved.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+  */
+
+#include "SysClockConf.h"
+#include "mbed.h"
+
+void HSE_SystemClock_Config(void) {
+    RCC_OscInitTypeDef        RCC_OscInitStruct;
+    RCC_ClkInitTypeDef        RCC_ClkInitStruct;
+    RCC_PeriphCLKInitTypeDef  PeriphClkInit;
+
+    RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
+    RCC_OscInitStruct.HSEState = RCC_HSE_ON;
+    RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
+    RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
+    RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
+    RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
+    HAL_RCC_OscConfig(&RCC_OscInitStruct);
+    RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
+    RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
+    RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
+    RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
+    RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
+    HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
+    PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC|RCC_PERIPHCLK_USB;
+    PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6;
+    PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL_DIV1_5;
+    HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit);
+}
+
+void confSysClock(void) {
+    HAL_RCC_DeInit();
+    HSE_SystemClock_Config();
+    SystemCoreClockUpdate();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BluePill/SysClockConf.h	Fri Mar 11 00:13:29 2022 +0000
@@ -0,0 +1,22 @@
+/*
+  ******************************************************************************
+  * @file    SysClockConf.h
+  * @version 
+  * @date    05-July-2016
+  * @brief   System Clock configuration for STM32F103C8T6
+  *****************************************************************************
+  *
+  * All rights reserved.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+*/
+#ifndef CONFSYSCLOCK_H
+#define CONFSYSCLOCK_H
+
+#pragma once
+void confSysClock(void);
+
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BluePill/stm32f103c8t6.h	Fri Mar 11 00:13:29 2022 +0000
@@ -0,0 +1,4 @@
+#pragma once
+#include "PinNames.h"
+#include "SysClockConf.h"
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Mar 11 00:13:29 2022 +0000
@@ -0,0 +1,786 @@
+/* ###########################################################################
+**    Archivo        : main.c
+**    Proyecto       : STM32-F103C8_Reloj
+**    Procesador     : STM32F103C8T6
+**    Plataforma     : Blue Pill
+**    Herramienta    : Mbed
+**    Plataforma     : Blue Pill
+**    Herramienta    : Mbed Compiler
+**    Compilador     : Mbed Online C Compiler
+**    Version        : Mbed-OS 5.15.0
+**    Fecha/Hora     :07-12-2021, 16:03
+**    Descripción    :Reloj fechador automatico con varios ajustes
+**   Componentes     : GPIO, Timer, Buzzer.
+**   Configuraciones : Includes, Stacks y Drivers externos
+**   Autores         :Salazar Servin Igal 
+**         
+**
+**   Versión        : Beta
+**   Revisión       : A
+**   Release        : 0
+**   Bugs & Fixes   :
+**   Date           : 00/00/2021
+**
+**
+** ###########################################################################*/
+/*
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+:  Includes
+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+*/
+#include "stm32f103c8t6.h"
+#include "mbed.h"
+#include "Serial.h"
+#include "iostream"
+#include "stdio.h"
+
+
+/*
+:...............................................................................
+:  Definiciones
+:...............................................................................
+*/
+
+#define FALSE           0               // Estado FALSO
+#define TRUE            1               // Estado VERDADERO
+#define Ticker_Rate     1000            // Periodo de interrupción (us)=1ms
+#define Baud_Rate       115200          // Velocidad de Transmisión (Bauds)
+#define Inicio_segundos 10
+#define Inicio_minutos  16
+#define Inicio_horas    16
+#define Inicio_dia      12
+#define Inicio_mes      12
+#define Inicio_anio     2021
+#define inicio_dia      1
+#define Contador        0                           
+#define Cuenta_regresiva            364                      
+#define Semana          1
+#define TDC             1                         
+#define AMPM            0                         
+#define FormatoH        1                      
+#define Verano          1                        
+
+/*
++-------------------------------------------------------------------------------
+|  Configuración de Puertos 
++-------------------------------------------------------------------------------
+*/
+//confSysClock();     // Configure system clock (72MHz HSE clock, 48MHz USB clock)
+Ticker      TimerInt;               // Inicializa la Interrupción por Timer
+DigitalOut  led_monitor(LED1);      // Inicializa el LED Monitor (Interno)
+DigitalOut  led_testigo(PB_1);      // Inicializa el LED Testigo (Externo)
+PwmOut      servo(PA_7);            // Inicializa el PWM
+AnalogIn    sensor1 (PB_0);         // Inicializa Canal Analógico para sensor 1
+Serial      terminal(PA_2, PA_3);   // Inicializa la Comunicación Serial a la PC
+/*
++-------------------------------------------------------------------------------
+|  Variables Globales de Usuario 
++-------------------------------------------------------------------------------
+*/
+char          Opcion;
+bool          Bandera1,Bandera2= TDC,Bandera3= FormatoH,Bandera4= AMPM,Bandera5=Verano;  
+              /*Bandera Num= BN 
+              B1=Año bisiesto                 ----->> 1=año bisiesto    0=año no bisiesto                 
+              B2=Tipo de calendario           ----->> tipo de calendario 1=julioano 0=gregoriano
+              B3=FORMATO DE 12 O 24 HRS       ----->> formato de 0=24hrs    1=12 horas AM/PM
+              B4=Formato de la hora AM-PM     ----->> inicio de medio dia 0=am  1=pm
+              B5=Cambio de horario de verano  ----->> Cambia De Horario 0=horario de verana 1=horario de invierno
+              */    
+int8_t        dia= inicio_dia,Dia= Inicio_dia,Mes= Inicio_mes,SemanaN= Semana;
+
+              /*
+              dia=inicio_dia    -->>inicializa la variable a un valor definido de 1-30 o 31
+              Dia= Inicio_dia   -->>inicializa la variable 0=lunes 1=martes 2=miercoles 3=jueves 4=viernes 5=sabado 6=domingo    
+              Mes=Inicio_Mes    -->>inicializa la variable a un valor definido de 1-12
+              SemanaN           -->>Auxiliar para saber el numero de semanas transcurridas
+              */
+              
+uint8_t       Segundos= Inicio_segundos ,Minutos= Inicio_minutos,Horas= Inicio_horas;
+                /*
+                Segundos= Inicio_segundos   -->> Inicializamos los segundo [0-60]
+                Minutos= Inicio_minutos     -->> Inicializamos los minutos [0-60]
+                Horas= Inicio_horas         -->> Inicializamos las horas   [1-24 o 1-12]segun el formato
+                */
+uint16_t      Anio= Inicio_anio,DiasT= Contador,DiasF= Cuenta_regresiva ;
+                
+                /*
+                Anio= Inicio_anio           -->> Inicializamos la variable de años
+                DiasT= Contador             -->> Contador que utilizartemos para ver los dias que han pasado desde 1-365 o 1-366
+                DiasF= Cuenta_regresiva     -->> Cntador que utilizartemos para ver los dias que han pasado desde 365- o 366-1
+                */
+
+string MES[12]={"ENERO","FEBRERO","MARZO","ABRIL","MAYO","JUNIO","JULIO","AGOSTO","SEPTIEMBRE","OCTUBRE","NOVIEMBRE","DICIEMBRE"};
+string DIA[7]={"LUNES","MARTES","MIERCOLES","JUEVES","VIERNES","SABADO","DOMINGO"};
+
+/* END variables */
+/*
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+|  Definición de Funciones Prototipo y Rutinas de los Vectores de Interrupción
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+*/
+        // Las Definiciones de Funciones Prototipo 
+        // y Apuntadores a Vectores de Interrupciones van aquí !
+
+void clear_screen(void); 
+void Portada(void);
+void Reloj(void);
+void Fecha(void);
+void Imprimir_reloj(void);
+void Imprimir_fecha(void);
+void Menu(void);
+void Cont(void);
+void reg(void);
+void Horario_Invierno_Verano(void);
+void Config_Hora();
+void Config_Fecha();
+
+/* END prototypes */
+
+/* END definitions */  
+/*
+#===============================================================================
+|
+|               P R O G R A M A     P R I N C I P A L
+|
+#=============================================================================== 
+*/
+int main() 
+{ 
+terminal.baud(Baud_Rate);  
+Portada();
+while(1) 
+  { 
+  while(!terminal.readable())
+   {
+    clear_screen();
+    Reloj();
+    Fecha();
+    Imprimir_reloj();
+    Imprimir_fecha();
+    wait(1);
+    }
+    terminal.getc();
+    Menu();
+   }   
+}
+/*----------------------------------------------------------------------------------------------------*/
+void Menu()
+{
+    clear_screen();
+    terminal.printf("\n\n\r\t\t    ------------------MENU------------------");
+    terminal.printf("\n\n\r\t\t   |           1)Configuracion  Hora           |");
+    terminal.printf("\n\n\r\t\t   |           2)Configuracion fecha           |");
+    terminal.printf("\n\n\r\t\t   |           3)Configuracion de horario      |");
+    terminal.printf("\n\n\r\t\t   |           4)Retornar                      |");
+    terminal.printf("\n\n\r\t\t   ------------------\e[0;37;41mIPN\e[0m ------------------");
+    Opcion = terminal.getc();
+    if(Opcion=='1')Config_Hora();    
+    if(Opcion=='2')Config_Fecha();
+    if(Opcion=='3')Horario_Invierno_Verano();
+}
+/*----------------------------------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------------------------------*/
+
+void Portada()
+{
+
+  clear_screen();
+   terminal.printf ("\e[0;30;42m100110010 00110000 00110001 00111001 00110011 00110101 00110000 00110010 00110101 00110110\e[0m\n\r");
+    terminal.printf ("\e[0;30;42m   \e[0m\r                                                                                       \e[0;30;42m   \e[0m\r");
+    terminal.printf ("\e[0;30;42m   \e[0m\e[1;37;41m\t\t\t  Instituto Politecnico Nacional  \e[0m\n\r");
+    terminal.printf ("\e[0;30;42m   \e[0m\r                                                                                       \e[0;30;42m   \e[0m\r");
+    terminal.printf ("\e[0;30;42m   \e[0m\e[1;37;42m\t\t  ESCUELA SUPERIOR DE INGENIERIA MECANICA Y ELECTRICA \e[0m\n\r");
+    terminal.printf ("\e[0;30;42m   \e[0m\r                                                                                       \e[0;30;42m   \e[0m\r");
+    terminal.printf ("\e[0;30;42m   \e[0m\r                                                                                       \e[0;30;42m   \e[0m\r");
+    terminal.printf ("\e[0;30;42m   \e[0m\e[1;37;43m\t\t\t\t Salazar Servin Igal \e[0m\n\r");
+    terminal.printf ("\e[0;30;42m   \e[0m\r                                                                                       \e[0;30;42m   \e[0m\r");
+    terminal.printf ("\e[0;30;42m   \e[0m\e[1;37;45m\t\t\t\t\t 4CV6 \e[0m\n\r");
+    terminal.printf ("\e[0;30;42m   \e[0m\r                                                                                       \e[0;30;42m   \e[0m\r");        
+    terminal.printf ("\e[0;30;42m   \e[0m\r                                                                                       \e[0;30;42m   \e[0m\r");
+    terminal.printf ("\e[0;30;42m   \e[0m\e[1;37;46m\t\t\t\t Analisis Numerico  \e[0m\n\r");
+    terminal.printf ("\e[0;30;42m   \e[0m\r                                                                                       \e[0;30;42m   \e[0m\r");    
+    terminal.printf ("\e[0;30;42m100110010 00110000 00110001 00111001 00110011 00110101 00110000 00110010 00110101 00110110\e[0m\n\r");
+        
+    wait(5);
+    
+terminal.printf ("\e[0;30;42m:::  :::   :::   :::  :::   :::   ::. f#tW   :::   :#E#L ::   :::   :::  :::   :::   :::  ::.   :     \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::  :::   :::   :::  :::   :::   ::: ,,:,   :::    :,,,:::   :::   :::  :::   :::   :::  ::.   :     \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::  .::   :::   :::  :::   :::   :: ,,,,,K  :::   #;,,,:::   :::   :::  .:.   :::   :::  :::   :     \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   :::   :::   ::   :::   :::  K,,,,,,.:   :: :,,,,,  :::   :::   ::   :::   .::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   :::   :::   ::   :::   :::  #:,,,,,#:   ::#,,,,,,  :::   :::   ::   :::   .::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   .::   :::   :.   ,f.   :::  #,,,,,:.:   ::t,,,,,,: :::   , tL  ::   :::   :::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  :::   :::   :::  ,t,,,:K.:   ::#,,,,,,: :::  :,,,,,, :   ::.#,,,,#  :::   :::   :::  ::.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  :::   :::   :::  t,,,,,,,:   ::W,,,,,,, :::  ;,,,,,: :   :.f,,,,,,  :::   :::   :::  ::.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   ::   .::   .::   .::   ,,,,,, .   .: ,,,,,,, ::. f,,,,,,.::   . .,,,,::  .::   .::   :::   :.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   :::   :::   ::  ,,,,,,..::    ,,,,,,,:::iW,,,,,,K  :::  ,,,,,,;::   :::   .::   ::   :::   \e[0m\n\r"); 
+terminal.printf ("\e[0;30;42m:::   ::   :::   :::   :: K,,,,,,:#::   #,,,,,,,,,,::,,,,,,f  :::#,,,,,,,#.:   :::   .::   ::   :::   \e[0m\n\r"); 
+terminal.printf ("\e[0;30;42m   ::.  .::   .::   .::  .j,,,,,,,:  : #i,,,,,,,,,,,,,,,,,,,Lj   .,,,,,,,   .::   .::   .::  .:.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  :::   :::   :::  :.,,,,,,,, tE:,,,:,::,::.:,,,,,,,,,,,;E ,,,,,,,j:  :::   :::   :::  ::.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  :::   :::   :::  :.,:,,,,,,,,,,,,.#E :,;,,,,,,:;#j:,,,,,,,,,,,,, :  :::   :::   :::  ::.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   .::  ##::   ::   i:,,,,,,,,.#.;,,,,..,ii..:,:,,:LD.,,,,,,,,,K  :.   :: D: :::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   ::: f,,,t.  ::   . ,,,,,;;G,,,.G#,:,,,,,,,:.t# ,,,.#..,,,,,:   ::   ff,,: ,::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   ::: :,,:::W ::   :#,,,,:;,,:Dt,,,,,,,,,,,,,,,:, #:,::#:,,,,#   ::  t,,,,:;:::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m... t############:,:. W#######W#######,,,,W##WK#,,,,#WKEEG #.,,#:,.WW### G.,;############ :.:   .     \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   ::: LGGGGGGGGGGGG,,,:jGGGGGGGGGGGGGGGG,,,,#GGGG#,,,,LGGGGG.,.#,,:.KGGGGGf:,,,GGGGGGGGGGGGE,::   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::#GGGGGGGGGGGGG,,,, GGGGGGGGGGGGGGGG,,,,#GGGG#,,,,LGGGGGW,:,G.:EGGGGGG ,,,,GGGGGGGGGGGGGW..   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   LGGGGGGGGGGGGG,,,,:GGGGGGGGGGGGGGGG,,,,#GGGG#,,,,LGGGGGG:,,:.EGGGGGGG ,,,,GGGGGGGGGGGGGL  ::.   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::  EGGGGGGGGGGGGGG,,,,:GGGGGGGGGGGGGGGG,:,;#GGGG#,,:,LGGGGGGL:,:,WGGGGGGG ,,,,GGGGGGGGGGGGGG# :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::  GGGGGW#######ED,,,,:GGGGD###########W   #GGGG#,,: fGGGGGGGW,,KGGGGGGGG.,,,,GGGGG#########W :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   .#GGGGL.   .:: .:,,,,:GGGGD,,,,,,,:f;  :::#GGGG#,,#:LGGGGGGGGD.GGGGGGGGG.,,,,GGGGG   .::  ::.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m    GGGGG,    .     #::,.GGGGG::::::,i..  :.:#GGGG#,,#:GGGGGGGGGGDGGGGGGGGG:,,:#GGGGG         .    :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   #GGGGGGGGGGGGGGGG,,,,KGGGGGGGGGGGGGGGG .:.#GGGG#,,#.GGGGGGGGGGGGGGGGGGGGi,,.:GGGGGGGGGGGGGGGGW  :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::LGGGGGGGGGGGGGGGGt,,K:GGGGGGGGGGGGGGGG:   #GGGG#,,# LGGGGGGGGGGGGGGGGGGG .,,DGGGGGGGGGGGGGGGGG::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m::DGGGGGGGGGGGGGGGGG,,.::GGGGGGGGGGGGGGGG:   #GGGG#,,# LGGGGGGGGGGGGGGGGGGG:E,,,GGGGGGGGGGGGGGGGGj:   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m  DGGGGGGGGGGGGGGGGG,,,,tGGGGGGGGGGGGGGGG .:.#GGGG#,,#.LGGGGGGGGGGGGGGGGGGG,,W,,GGGGGGGGGGGGGGGGG# :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m  GGGGGGGGGGGGGGGGGG,;,,;GGGDGGGGGGGGGGGG :::#GGGG#,,#:GGGGGGGGGGGGGGGGGGGG#: :,GGGGGGGGGGGGGGGGGL :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m  GGGGG ::::........;;,#,:::::::;  jGGGGG ...#GGGG#,, #GGGGGWGGGGGGGGLGGGGG.:,G;GGGGG:::::::  ..   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:#GGGG##,,,,,,,,,,,,,,, ,,,,,,,,,# fGGGGG: W:#GGGG#,,,,LGGGG LGGGGGGG:LGGGG:#, ,GGGGG,,,,,,,E   .::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:LGGGG##############i:#::###########GGGGGW,,,#GGGG#j.,:LGGGG .GGGGGGL,GGGGG,,.,KGGGGG#######W######   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m LGGGGGGGGGGGGGGGGGG,,.,.GGGGGGGGGGGGGGGL,,,.#GGGG#,,,#LGGGG  #GGGGD,,GGGGG,,#,,GGGGGGGGGGGGGGGGGGG   \e[0m\n\r");
+terminal.printf ("\e[0;30;42mfGGGGGGGGGGGGGGGGGGG,.,,.GGGGGGGGGGGGGGGL,.W,#GGGG#:,,,GGGGG ::GGGG.,,GGGGG,, ,,GGGGGGGGGGGGGGGGGGG   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m#GGGGGGGGGGGGGGGGGGG:#,,.GGGGGGGGGGGGGGGG.,::WGGGGW:LD,LGGGG ,:;GDE,,,GGGGG,,,.,GGGGGGGGGGGGGGGGGGG#  \e[0m\n\r");
+terminal.printf ("\e[0;30;42mLGGGGGGGGGGGGGGGDGGL, ,, GGGGGGGGGGGGGGGL.;.L#DDGG#:,,:GGGGG.,,,E#,,,,GGGGG,,,#;GGGGGGGGGGGGGGGGGGDW  \e[0m\n\r");
+terminal.printf ("\e[0;30;42mWWWWWWWWW######W#WW# ,,,:##W##########WWW::.,###WW#W:,,####K ,,,,:,,,WW####,,:i;###WWWKKEDDDDDGGGGGf  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   ::: #:,j,E,,,,,, .::f.:,,,iGGGGW,:,,:    .,,,:#LGGL:,,,: j::  ,,,,,:::j,,..::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   .:: #,,:,#,,,,,L :::  W:, GGGGGGGE: K   :#,:#GGGGGGG.,:# :::   ,,,,, ,#,,:,::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  .::   :t,,:,,,,,,,W:   ::: .WGGGGGGGLE  :::  GKGGGGGGGG#t ::   :.#,,,,,E,j:,:   :::  .::   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  ##ftL##.,:,,.,,,,, :   ::: LGGGLW,#LLGD :::  LGGGL#WGGGLj:::   ::E,,,,,#,.,,,##EE##   :.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   ::tf,,,,,,,,,:,,,:,,,,, :   :::  GGGi:,::WGGL::: fGGGE,,#:GGG::::   :. ,,,,,#,:,,,,,,,,:,.# .   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::  ;,,,,,,,,,,,:,:,,,,,.  ::.   :jGGW.,,,: #GGD  GGG#W,,,K:#GG;   :.:   :,,,,L,,,,,,,,,,,,,,. :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::  ,,,,:,:,,,,,,,.,,,,,.  :::   :KGGKi:,,: .WDGWLGG#  ,,,f,jGGE   :::   :,,,,i,,,,,,,,,,:,,,: :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::  ,,,,,W:,,,,,,,.,,,,,.  :::   :#GG.;,,:: :.#GDGG#.  :,,f,tGGG   :::   :,,,,i,,,,,,,,L,:,,,, .::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::,,,:,WL,:,,:,:,,,,,:.:   ::: #GG..;,,,.   WGGW  :f,,,#:WGGi:::   ::.,,,,,G,,,,,, #::,,,,,.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :: #:;,,,:G#:,.,,:,,,,, .   ::: DGG.,.,,,L  fGG#G  .i,,,f,KGG :::   :: ,,,,,#,::,.DW;,:,,.# .   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   .: j##G #LG ,,:,,,,,  :::   :iGG.,#,,,, .GGKLGK: ;,,,:, GGi   :::  t,,,,:#,.:#Gi####L :   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   ::: WDG::;,,,,,# :::   i GG#,..,,,:KGL GGGW:,,:#,:tGG,.  :::  #,,,,,D,WGD#.::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   .:: KiLGWK::,,,D ::.  W:.GG.:,#,,,fGG;  WDG.,,.,,D#GL,,# :.:  f,,,;ifGG#:#:::   :.   ::.   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   ::.  .::   :#,,KGGD.,,,.    E,,,,GG##::E,;GG#,,,;GGL:..:G:WG#,,,,#  :W;,,,LGLGD,::   :::  :::   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  :::   : ,,#WGGG#.,,:WLG,,,,,KD#;G,;#WGG,,,,,fGGi:,. ,LG#,,,,,,,#,:,,DGGE: ,:.   :::  ::.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   ::.  :::   :  ,j,;LGGG#.,:,,,K.:,#GG,.t:,LGt,,,,:,WGD,,,,.GG:,,;#,,,,,:#GGG#,.,,.,   :::  .::   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   :Ef:,,,,:,#WGGGGW:,,,GG#,.GG:,,E#G# #Kif#i:GG# ;,#GG,,GLG,,,.EGGGL,:,#,,,:,#    ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   :: .f::,,,,,:W,.,#GGGGG#.:GGG#:GG;,, DL,:,:,,,:,jGD.,,KGW,#GGG,.#LGGGW. ,,,,,,,,,,W  ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   :: G,,,,,,,,,i,, ,,LGGGGGKGGGGGWG#W;#G#W,:,:,,.#,LG#,#GG#DGGGGWGGGGG#,:#,:,,,,,,,,,:#,:   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   ::.   ,:,,,,,,,,,.,#:,.DGGGDGLGGGGGWG iGL.;,,   :,,:jGGL:GKGGGGGGGGGGLD,,:.:#,,,,,,,,,,,L :::   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  ,,,,,,,,,,,,G,, ,,;DGGGGGGGGGGGD,#G# ,,,,,,,,,;;#G##GGGGGGGGGGGD:,,:#,.:,,,,,,,,,,,,i::.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   ::. #,,,,,,,:,,,:,::K,,,,tLGGGGGGGGGGG#G:.#:,,,,,,.i: GWLGGGGGGGGGG#,,,,..,#:,:.,,,,,,,,,#:::   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   . ,,,,,,,,:#K:,D,,;,,,, EGGGGGGGGGGD#  ,K,,,,,,#   WGGGGGGGGGGGL::,,:K:,,:,f#.,,,,,,,,    :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::,,:,::iG : :,;.,,,,,,,;#GGGGGGGGGGGG,:K,,,,,,# tLGGGGGGGGGLG.,,,,,.,,#,,D:  W:,:,,,.:   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m...   ..    .:   ..W::i,,#:,,,,,iLGGGGGGGGGGG#D,,,,:,#WGGGGGGGGGGD#,,,,,::;;;::. .   ::    ..   ...   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  .::   ...   t::W:,;::::::.KGGGGLDGGGGLD,,,,:ifGGGGGDGGGGLt,:,,,,:K::,,:D   ..    ..  :::   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  :::E                      ;#GGGGGWLGGGGGj,,#GGGGGLEWGGGG.::#                     ..  ::.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   ::    ::                        ,DGGL#GK#LGDGG#KGGGGGWLGDGG#,,,#                     i.:   :.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   :E                      :,:DL #G, DGGGGGGGDj GGWELW,,,#                     K   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   :. :::K.,KW             i,:GKiWGE #:KGGGG#;D DL# GG:,G              .#E###W ,   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  :::   :.#,,,,,G             W#G#j:GLELGLGGLGGD.LGG,,GG :             #,,,,:::   :::  ::.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  :::   :j,,,,,,,,, ,,tD       DG    G#GGE :,;GGDWGW  #G#        K,:.,;,,,,,,.    :::  ::.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   ::.  :::   ,:,,,,,,,:  E,,:#      GL   iLDK.      DLG#   :GE      .E;:L :,,,,,,,,K   :::  .::   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   :::t,,,,,,,,..  #:,:#    ;G#  EGGEL        LWGG   DG      ;,,# .f:,,,,,,,, ::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   :::#,,,,,,,; :   W,,,D   #DK WGf #GK      #GE #Li LG     ,;,#  :...,,,,,,,#::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m..:   ..   ... :,,,,.# ..   :#,,,#  GGWE.:   GG.    #GD    #WWGK    ,;t   .:  #:,,,:G,..   .:   :.:   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  :::   :::.:# ::  ::: :,,,,:iL#:,,,;#LWGG    GL# # ,,:#L#..,,,,. ::  ::: #.,i.   :::  ::.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  :::   :.W#  :::  ::::,,,,,,,EG#;:,:,,iDGi  KGEW,,,,:WWGW,:,,,,:G::  :::   G.:   :::  ::.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   ::.  :::   :::   :::  ::i:,,,,,, GG,,.Kf.,,;Df #GG,,, #i:,,GL,,,,,,,,.:  :::   :::   .::  :::   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   :::   :::   ::  ,,,,,,:,iGG:,:,,,,:.KL#GG,.,,,,,,::GGt,,,,,,,: ::   :::   .::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   :::   :::   :: G,,,,,,,LjGG W;,,,,,,,KDG#.,,,,,,LL GG..,,,,,,,.::   :::   .::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   .::   :::   :: G,,,,,,,.fGG  #,,,,,,.LGK#;,,,,,,; .GG #,,,,,,,#::   :::   :::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   ::.  :::   .::   :::  ::,,,,,,# jGG.: ,,,,,:LGDLL#,,,,,,#:fGG  .,,,,,,   :::   :::   :::  :::   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  :::   :::   :::   ,,,,,,D:  GG# ,,,,,fLGD fGGD.,,,,..#GG : .,,,,,,  :::   :::   :::  ::.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   ::.  .::   .::   :::   ,,,,,: :  GGL ,,,,DLGL .:GGGLi:,,: GGG :.L;,,,,,  .::   :::   .::  .:.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   :::   .::   :: L,,,:i  ::GGGW.,,KDGG:   .#GGGEf.,GDGL:   #,,,,# :   :::   :::   :.   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   :::   :::   ::   ,:.   :.#GGGGGGGGK#:   :..GGGGGGGGG#:   ..j#  ::   :::   .::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   ...  ...   ...   ...   ..   ...  :DGGGGDGW:: ...  #:EGGGGGGD  ...   .:.  ...   ...   ...   .:   .  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  .::   :::   :::  ::.   :::   #GGGGLK;:  ::.   :;DGGGGG#  :::   :::  .:.   :::   .::  :::   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m   :::  :::   :::   :::  :::   :::   :#DD#.::#  :::   K,,;j##G   :::   :::  :::   :::   :::  ::.   :  \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   :::   :::   ::   :::   :::   ,,,,..::   ::: :;,,   :::   :::   ::   :::   :::   ::   :::   \e[0m\n\r");
+terminal.printf ("\e[0;30;42m:::   ::   :::   :::   :.   :::   :::   .:###:.:   ::. ##K.   :::   :::   ::   :::   :::   :.   :::   \e[0m\n\r");
+
+    wait(5);
+}
+
+/*-------------------------------------------------
+---------------------------------------------------*/
+void clear_screen() //esta funcion te limpia la pantalla
+{
+    terminal.printf("\x1B[2J");
+    terminal.printf("\x1B[H");
+}
+/*-------------------------------------------------
+---------------------------------------------------*/
+void Reloj() // esta funcion te cuenta los minutoos al igual que te hace los cambios de hora
+{
+    Segundos++;   
+    if(Segundos>=60)
+    {
+        Minutos++;
+        Segundos= 0;
+    }
+    if(Minutos>=60)
+    {
+        Horas++;
+        Minutos=0;
+    }
+     if(Horas>=24 && Bandera3==0)               //Formato de 24 hrs
+    {
+        Horas=1;
+        Dia++;
+        dia++;
+        DiasT++;
+        DiasF--;
+        if(dia>=7)dia=0;
+        if(Bandera2==1&& dia==0)SemanaN++;
+        if(Bandera2==0&& dia==6)SemanaN++;
+     }
+             if(Horas>=13 && Bandera3==1)Horas=1;               //Formato de 12 hrs           //si la hora es mayor o igual a 13 y la bandera de formato de hora es 1 la variable horas la erestablecea a 1 
+     if(Horas==12&& Minutos==0 && Segundos==0 && Bandera3==1)   // PM
+      {
+         Bandera4=!Bandera4;
+         if(Bandera4==1)                                        // BANDERA4: 0=AM 1=PM
+        {
+         Dia++;
+         dia++;
+         DiasT++;
+         DiasF--;
+         if(dia>=7)dia=1;
+         if(Bandera2==1&& Dia==0)SemanaN++;
+         if(Bandera2==0&& Dia==6)SemanaN++;
+        }  
+      }
+   
+}
+/*----------------------------------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------------------------------*/
+void Horario_Invierno_Verano()// esta funcion se usa para el cambio de hora en la semana 14 y semana 44
+{
+    int opcion;
+intento: 
+    clear_screen();
+    terminal.printf("\n\t 0.-ACTIVAR HORARIO DE INVIERNO\n\r");
+    terminal.printf("\t   1.-ACTIVAR HORARIO DE VERANO\n\r");
+    terminal.printf("\t   2.-SALIR\n\r");
+    opcion=terminal.putc(terminal.getc())-48;
+    
+    if(opcion==0&&Bandera5==0)
+    {
+        clear_screen();
+        terminal.printf("\n\tACTIVADO HORARIO DE INVIERNO");
+        Bandera5=0;
+        Horas--;
+        wait(1.5);
+        return;
+    }
+    if(opcion==1&&Bandera5==1)
+    {
+       clear_screen();
+       terminal.printf("\n\tACTIVADO HORARIO DE VERANO");
+       Bandera5=0;
+       Horas++;
+       wait(1.5);
+       return;
+    }
+    if(opcion>2)
+    {
+        clear_screen();
+        terminal.printf("\n\r\tintente de nuevo, valor ingresado incorrercto");
+        wait(1.5);
+        goto intento;
+    }
+    if(opcion==2)return;
+}
+
+/*----------------------------------------------------------------------------------------------------*/
+
+/*----------------------------------------------------------------------------------------------------*/
+
+void Imprimir_reloj()
+{
+    if(Bandera3==0)terminal.printf               ("\r\n\t\t\e[31m  %i:%i:%i  hrs\e[0m\n\r",Horas,Minutos,Segundos);
+    if(Bandera3==1 && Bandera4==1)terminal.printf("\r\n\t\t\e[31m  %i:%i:%i   AM \e[0m\n\r",Horas,Minutos,Segundos);
+    if(Bandera3==1 && Bandera4==0)terminal.printf("\r\n\t\t\e[31m  %i:%i:%i   PM \e[0m\n\r",Horas,Minutos,Segundos);
+}
+/*----------------------------------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------------------------------*/
+void Imprimir_fecha(){
+    
+    terminal.printf("\n\r\tHOY ES  %s   %i/%s/%i    ",DIA[dia],Dia,MES[Mes-1],Anio);
+    terminal.printf("\n\r\t\e[1;36m Semana en curso: %i , Los dias transcurridos son: %i , Los dias faltantes son: %i\e[42m" , SemanaN,DiasT,DiasF);
+    if (Bandera1==1)terminal.printf("\n\r\t\e[1;31;40m Este anio es bisiesto\e[42m");
+    if (Bandera1==0)terminal.printf("\n\r\t\e[1;34;40m Este anio no es bisiesto\e[42m");
+    if (Bandera2==1)terminal.printf("\n\r\t\e[0;37;40m Calendario Juliano\e[42m");
+    if (Bandera2==0)terminal.printf("\n\r\t\e[1;32;40m Calendario Gregoriano\e[42m");
+    if (Bandera5==0)terminal.printf("\n\r\t\e[1;36;48m HORARIO DE Invierno:\e[0m \e[41mSI\e[0m\n\r");
+    if (Bandera5==1)terminal.printf("\n\r\t\e[0;31;40m HORARIO DE Verano:\e[0m \e[42mSI\e[0m\n\r");
+    }
+/*----------------------------------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------------------------------*/
+
+void Fecha(){
+    
+     if(Dia>=32 && Mes!=2 && Mes!=4 && Mes!=6 && Mes!=9 && Mes!=11)
+    {
+        Mes++;
+        Dia=1;
+    }
+    if(Dia==31 && Mes!=1 && Mes!=2 && Mes!=3 && Mes!=5 && Mes!=7 && Mes!=8 && Mes!=10 && Mes!=12) //si el dia es igu
+    {
+        Dia=1;
+        Mes++;
+        
+    }
+   if(Dia==30 && Mes==2 && Bandera1==1) //si el dia es igual a 30 y la variable mes es igual al mes 2 y la bandera de año bisiesto es igual a 1 entra
+    {
+        Dia=1;      //restablece la variable dia a 1
+        Mes++;      //incrementa una unidad la Variable mes
+    }
+    if(Dia==29 && Mes==2 && Bandera1==0) //si el dia es igual a 29 y la variable mes es igual al mes 2 y la bandera de año bisiesto es igual a 0 entra
+    {
+        Dia=1;        //restablece la variable dia a 1
+        Mes++;        //incrementa una unidad la Variable mes
+    }
+    if(Mes>=13)             //si la Variable mes es mayor igual a 13 entra
+    {
+        Mes=1;                  //restablece la variable mes a 1
+        Anio++;                  //incrementa la variable año una unidad
+        SemanaN=1;               //restablece la variable semana a 1
+       if(Anio%4==0||Anio%400==0)Bandera1=1;                    //si el residuo del año dividido entre 4 es 0 o el residuo de ano dividido entre 400 es 0 es un año bisiesto
+        if(Anio%4!=0||(Anio%100==0&&Anio%400!=0))Bandera1=0;
+        DiasT=0;                   //restablece la variable DIAS TRANSCURRIDOS A 0
+        if(Bandera3==0)DiasT=364;    //si el año no es bisiesto la variable Dias Por Transcurrir la iguala a 364
+        if(Bandera3==1)DiasT=365;    //si el año es bisiesto la variable Dias Por Transcurrir la iguala a 365
+    }   
+}
+
+/*----------------------------------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------------------------------*/
+
+
+void Config_Hora()  // configura la hora tanto en formato de 24hrs y 12hrs am/pm
+{
+    int op;                         //variable para guardar la opcion qe eligamos
+    uint8_t Thora;                  //variable temporal cdonde se guardara la hora para despues asignarla a nnuestra varaiable Horas
+    uint8_t Tminutos;
+    uint8_t Tsegundos;
+    bool TBandera3;                 //Configuracion de Formato 12hrs y 24hrs
+    bool TBandera4;                 //Configuracion de Meridiano (PM/AM)
+    
+    inicio_configuracion:
+    clear_screen();
+    
+    terminal.printf("\n\r\e[33mFormato\e[0m");
+    terminal.printf("\n\r\e[31m 1)24hrs\e[0m");
+    terminal.printf("\n\r\e[31m 2)12hrs\e[0m");
+    terminal.printf("\n\r\e[33m 3)Regresar\e[0m");
+    op = terminal.getc();
+    if(op=='1')
+    {
+        intento:
+        clear_screen();
+        TBandera3=0;
+        terminal.printf("\n\r\tDigite la hora para el formato de  24hrs: HH:MM:SS\n");
+        Thora = (terminal.putc(terminal.getc())-48)*10;      
+        Thora = terminal.putc(terminal.getc())-48+Thora;
+        terminal.printf(":");
+        Tminutos = (terminal.putc(terminal.getc())-48)*10;
+        Tminutos = terminal.putc(terminal.getc())-48+Tminutos;
+        terminal.printf(":");
+        Tsegundos = (terminal.putc(terminal.getc())-48)*10;
+        Tsegundos = terminal.putc(terminal.getc())-48+Tsegundos;
+        Horas= Thora;
+        Minutos= Tminutos;
+        Segundos= Tsegundos;
+        wait(.5);
+       
+        if(Thora>=24||Tminutos>=60||Tsegundos>=60)
+        {
+        clear_screen();
+        terminal.printf("\n\r\t ERROR , TRY AGAIN");
+        wait(2);
+        goto intento;
+        }  
+        Bandera3=TBandera3;  
+    }
+      
+    if(op=='2')
+    {
+        intento2:
+        clear_screen();
+        
+        TBandera3=1;
+        terminal.printf("\n\r\tDigite la hora en formato de 12hrs: HH:MM:SS AM/PM\n");
+        Thora = (terminal.putc(terminal.getc())-48)*10;      
+        Thora = terminal.putc(terminal.getc())-48+Thora;
+        terminal.printf(":");
+        Tminutos = (terminal.putc(terminal.getc())-48)*10;
+        Tminutos = terminal.putc(terminal.getc())-48+Tminutos;
+        terminal.printf(":");
+        Tsegundos = (terminal.putc(terminal.getc())-48)*10;
+        Tsegundos = terminal.putc(terminal.getc())-48+Tsegundos;
+        Segundos= Tsegundos;
+        Horas= Thora;
+        Minutos= Tminutos;
+         wait(.5);
+         if(Thora<1||Thora>=13||Tminutos>=60||Tsegundos>=60)
+        {
+            clear_screen();
+            terminal.printf("\n\r\ERROR , TRY AGAIN");
+            wait(.5);
+            goto intento2;
+        }
+        
+        AMPM1:
+        clear_screen();
+        terminal.printf("\n\r0)PM");
+        terminal.printf("\n\r1)AM");
+        terminal.printf("\n\r2)SALIR");
+        TBandera4=terminal.putc(terminal.getc())-48;
+        if(TBandera4>=3)
+        {
+            clear_screen();
+            terminal.printf("\n\r\tERROR , TRY AGAIN");
+            wait(2);
+            goto AMPM1;
+        }  
+        Bandera3= TBandera3;
+        Bandera4= TBandera4;
+    }  
+    if(op>'4')
+    {
+        clear_screen();
+        terminal.printf("\n\r\tERROR , TRY AGAIN");
+        wait(2);
+        goto inicio_configuracion;
+    }
+}
+
+
+
+/*----------------------------------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------------------------------*/
+
+void Cont()
+{
+     Dia++;
+     dia++;
+     DiasT++;
+     DiasF--;
+     if(dia>=7)dia=0;
+     if(Bandera2==1&& dia==0)SemanaN++;
+     if(Bandera2==0&& dia==6)SemanaN++;
+    
+    if(Dia>31&& (Mes==1||Mes==3||Mes==5||Mes==7||Mes==8||Mes==10||Mes==12))
+    {
+        Mes++;
+        Dia=1;
+    }
+    if(Dia>=31 && Mes!=1&&Mes!=2&&Mes!=3&& Mes!=5&&Mes!=7&&Mes!=8&&Mes!=10&& Mes!=12)
+    {
+        Dia=1;
+        Mes++;
+        
+    }
+    if(Dia>28 && Mes==2 && Bandera1==0)
+    {
+        Dia=1;
+        Mes++;
+        
+    }
+    if(Dia>29 && Mes==2 && Bandera1==1)
+    {
+        Dia=1;
+        Mes++;
+        
+    }
+    if(Mes>12)
+    {
+        Anio++;
+        SemanaN=1;
+        Mes=1;
+        
+        if(Anio%4==0||Anio%400==0)Bandera1=1;
+        if(Anio%4!=0||(Anio%100==0&&Anio%400!=0))Bandera1=0;
+        
+        if(Bandera1==1) DiasF=365;
+        if(Bandera1==0) DiasF=364;
+        DiasT=0;
+    }
+   
+}
+/*----------------------------------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------------------------------*/
+
+void reg()
+{
+     Dia--;
+     dia--;
+     DiasT--;
+     DiasF++;
+     if(dia<0)dia=6;
+     if(Bandera2==1&& dia==6)SemanaN--;
+     if(Bandera2==0&& dia==5)SemanaN--;
+    
+    if(Dia<=0&& (Mes==2||Mes==4||Mes==6||Mes==8||Mes==9||Mes==11||Mes==1))
+    {
+        Mes--;
+        Dia=31;
+    }
+    if(Dia<=0 && Mes!=2&&Mes!=3&&Mes!=4&&Mes!=6&& Mes!=8&&Mes!=9&&Mes!=11&&Mes!=1)
+    {
+        Dia=30;
+        Mes--;
+        
+    }
+    if(Dia<=0 && Mes==3 && Bandera1==0)
+    {
+        Dia=28;
+        Mes--;
+        
+    }
+    if(Dia<=0 && Mes==3 && Bandera1==1)
+    {
+        Dia=29;
+        Mes--;
+        
+    }
+    if(Mes<=0)
+    {
+        Anio--;
+        SemanaN=53;
+        Mes=12;
+         if(Anio%4==0||Anio%400==0)Bandera1=1;
+         if(Anio%4!=0||(Anio%100==0&&Anio%400!=0))Bandera1=0;
+        
+        if(Bandera1==1) DiasT=365;
+        if(Bandera1==0) DiasT=364;
+        DiasF=0;
+    }
+}
+
+/*----------------------------------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------------------------------*/
+void Config_Fecha()//configura la fecha tanto el dia mes y año con el calendario  gregoriano y juliano
+{
+    int op2,op3;
+    uint8_t TDia;
+    uint8_t TMes;                                   
+    uint16_t TAnio;
+    bool TBandera1;                                 //Configuracion del año Bisiesto 
+    bool TBandera2;                                 //Configuracion de Calendario 0)Gregoriano o 1)juliano 
+    
+    inicio_configuracion:
+    clear_screen();
+    
+    terminal.printf("\n\rIngresa la Fecha:");
+    terminal.printf("\n\r1)Cambiar" );
+    terminal.printf("\n\r2)Regresar");
+    
+    op2 = terminal.getc();
+    if(op2=='1')
+    {
+        
+        clear_screen();
+        TBandera1=1;
+        TBandera2=1;
+        terminal.printf("\n\rTipo de Calendario:");
+        terminal.printf("\n\r0)Gregoriano");
+        terminal.printf("\n\r1)Juliano");
+        terminal.printf("\n\r2)Regresar");
+        op3 = terminal.getc();
+        
+        if(op3=='1')
+        {
+        TBandera2=1;
+        Inicio:
+        clear_screen();
+        terminal.printf("\n\r\tDame tu fecha en formato de DD/MM/AAAA");
+        terminal.printf("\n\r\tDame la Fecha: ");
+        TDia = (terminal.putc(terminal.getc())-48)*10;       ///////////////
+        TDia = terminal.putc(terminal.getc())-48+TDia;
+        terminal.printf("/");
+        TMes = (terminal.putc(terminal.getc())-48)*10;
+        TMes = terminal.putc(terminal.getc())-48+TMes;
+        terminal.printf("/");
+        TAnio = (terminal.putc(terminal.getc())-48)*1000;
+        TAnio = (terminal.putc(terminal.getc())-48)*100+TAnio;
+        TAnio = (terminal.putc(terminal.getc())-48)*10+TAnio;
+        TAnio = (terminal.putc(terminal.getc())-48)+TAnio;
+        
+        if(TAnio%4==0||TAnio%400==0)TBandera1=1;
+        if(TAnio%4!=0||(TAnio%100==0&&TAnio%400!=0))TBandera1=0;
+        
+    
+        if((TDia>31&& (TMes==1||TMes==3||TMes==5||TMes==7||TMes==8||TMes==10||TMes==12))||
+          (TDia>=31 && TMes!=1&&TMes!=2&&TMes!=3&& TMes!=5&&TMes!=7&&TMes!=8&&TMes!=10&&TMes!=12)||
+          (TDia>28 && TMes==2 && TBandera1==0)||
+          (TDia>29 && TMes==2 && TBandera1==1)||
+          (TMes>=13||TMes<=0))
+          {
+          terminal.printf("\n\r\tERROR , TRY AGAIN");
+          terminal.getc();
+          goto Inicio;
+          }
+        if((TAnio>Anio)||(TAnio==Anio && TMes>Mes)||(TAnio==Anio && TMes==Mes && TDia>Dia))
+        while(Anio!=TAnio||Mes!=TMes||Dia!=TDia)Cont();
+        if((TAnio<Anio)||(TAnio==Anio && TMes<Mes)||(TAnio==Anio && TMes==Mes && TDia<Dia))
+        while(Anio!=TAnio||Mes!=TMes||Dia!=TDia)reg();   
+        }
+        
+        if(op3=='0')                //Calendario Gregoriano
+        {   
+        TBandera2=0;
+        Bandera2=TBandera2;
+        Inicio2:
+        clear_screen();
+        terminal.printf("\n\r\tDame la fecha en formato de DD/MM/AAAA");
+        terminal.printf("\n\r\tDame la Fecha: ");
+        TDia = (terminal.putc(terminal.getc())-48)*10;    
+        TDia = terminal.putc(terminal.getc())-48+TDia;
+        terminal.printf("/");
+        TMes = (terminal.putc(terminal.getc())-48)*10;
+        TMes = terminal.putc(terminal.getc())-48+TMes;
+        terminal.printf("/");
+        TAnio = (terminal.putc(terminal.getc())-48)*1000;
+        TAnio = (terminal.putc(terminal.getc())-48)*100+TAnio;
+        TAnio = (terminal.putc(terminal.getc())-48)*10+TAnio;
+        TAnio = (terminal.putc(terminal.getc())-48)+TAnio;  
+                 
+        if(TAnio%4==0||TAnio%400==0)TBandera1=1;
+        if(TAnio%4!=0||(TAnio%100==0&&TAnio%400!=0))TBandera1=0;
+        
+    
+        if((TDia>31&& (TMes==1||TMes==3||TMes==5||TMes==7||TMes==8||TMes==10||TMes==12))||
+          (TDia>=31 && TMes!=1&&TMes!=2&&TMes!=3&& TMes!=5&&TMes!=7&&TMes!=8&&TMes!=10&&TMes!=12)||
+          (TDia>28 && TMes==2 && TBandera1==0)||
+          (TDia>29 && TMes==2 && TBandera1==1)||
+          (TMes>=13||TMes<=0))
+          {
+          terminal.printf("\n\r\tERROR , TRY AGAIN");
+          terminal.getc();
+          goto Inicio2;
+          }
+        if((TAnio>Anio)||(TAnio==Anio && TMes>Mes)||(TAnio==Anio && TMes==Mes && TDia>Dia))
+        while(Anio!=TAnio||Mes!=TMes||Dia!=TDia)Cont();
+        if((TAnio<Anio)||(TAnio==Anio && TMes<Mes)||(TAnio==Anio && TMes==Mes && TDia<Dia))
+        while(Anio!=TAnio||Mes!=TMes||Dia!=TDia)reg();                                      
+        }
+        if(op3=='2')return;    
+    } 
+    if(op2=='2')return;
+    if(op2>'3')
+    {
+        clear_screen();
+        terminal.printf("\n\r\tERROR , TRY AGAIN");
+        wait(2);
+        goto inicio_configuracion;
+    }
+}
+
+/*----------------------------------------------------------------------------------------------------*/
+/*----------------------------------------------------------------------------------------------------*/
+
+/* END Mbed */ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Mar 11 00:13:29 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file