Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 #include "mbed.h" 00002 #include "Motor.h" 00003 #include "scolor_TCS3200.h" 00004 00005 #include "Arial12x12.h" 00006 #include "Arial24x23.h" 00007 #include "Arial43x48_numb.h" 00008 #include "pict.h" 00009 #include "pavement_48x34.h" 00010 #include "ILI9341.h" 00011 00012 // Puerto de comunicacion Serial 00013 Serial CoolTerm(USBTX, USBRX); 00014 00015 // TFT 00016 ILI9341* tft; 00017 00018 // Motores m1step 00019 TraccionD Motores(PB_5, PB_3, PB_10, PB_4, 200, 3.75, 15.5) ; 00020 00021 /// PWM OUTPUTS 00022 PwmOut Buzzer(D14); // LED1 00023 00024 // Temporizadores 00025 Ticker MuestrearCOLOR; 00026 00027 // SENSOR DE COLOR 00028 scolor_TCS3200 SENSOR_COLOR (PA_9, PC_7, PB_6, PA_7, PA_8); 00029 00030 00031 // Lecturas Analogas de Joystick 00032 AnalogIn JEjeX(A0); 00033 AnalogIn JEjeY(A1); 00034 00035 00036 // Salidas digitales 00037 DigitalOut LED(PA_5); 00038 00039 00040 // Interrupcion Externa 00041 InterruptIn button1(USER_BUTTON); 00042 00043 00044 //****************************************************************************** 00045 /// Declarar Variables Globales 00046 00047 00048 00049 00050 /// Variables sensor de color 00051 long red; //Almacenan el Tiempo que dura el CicloUtil de la frecuencia 00052 long blue; //Generada por el Sensor TSC3200, al leer el componente 00053 long green; //R, G, B o Clear del color que tenga en Frente 00054 long clear; 00055 00056 00057 00058 /// Variables y Constantes para Interrupcion Serial 00059 #define valorInicial 0xAA 00060 uint8_t n_interrupcion = 0; 00061 uint8_t ComandoRecivido = valorInicial; 00062 uint8_t Parametro = valorInicial; 00063 00064 00065 /// Constantes Sensor de Color 00066 #define CMD_rojo 0x01 00067 #define CMD_azul 0x02 00068 #define CMD_verde 0x03 00069 #define CMD_clear 0x04 00070 #define ColorNoIdentificado 0x00 00071 00072 00073 uint8_t color_identificado = ColorNoIdentificado; 00074 uint8_t color_anterior = 0; 00075 00076 00077 /// Varialbles Buzzer 00078 uint8_t duracion_tono = 1; // Variable que almacena el Tiempo que es ESCUCHARÁ el Tono 00079 uint8_t tipo_tono = 1; // Variable que almacena el Tono que se desee escuchar 00080 00081 /// Constantes Buzzer 00082 #define TONO_DO 0x01 /// si tipo_tono == 0x01, se escuchará un DO 00083 #define TONO_RE 0x02 /// si tipo_tono == 0x02, se escuchará un RE 00084 #define TONO_MI 0x03 /// si tipo_tono == 0x03, se escuchará un MI 00085 #define TONO_SI 0x04 /// si tipo_tono == 0x04, se escuchará un SI 00086 00087 #define DO 3.78 /// Duración del periodo en ms, que se pondrá en el Buzzer.period_ms() PARA ESCUCHAR UN DO 00088 #define RE 3.36 /// Duración del periodo en ms, que se pondrá en el Buzzer.period_ms() PARA ESCUCHAR UN RE 00089 #define MI 3.03 /// Duración del periodo en ms, que se pondrá en el Buzzer.period_ms() PARA ESCUCHAR UN MI 00090 #define SI 2.82 /// Duración del periodo en ms, que se pondrá en el Buzzer.period_ms() PARA ESCUCHAR UN SI 00091 00092 Timeout TimeBuzzer; 00093 00094 00095 #define limite 0.727 00096 00097 // variables de control y flujo de programa 00098 00099 uint8_t programa_ejecutar = 0; // Variable que almacena la ORDEN (Telemetria ó Telecomando) 00100 // enviada desde el CoolTerm 00101 uint8_t coolterm_data; // Se almacenan Todos los Caracteres recividos por el CoolTerm. 00102 00103 uint8_t new_command = 0; 00104 // Constantes de velocidad 00105 00106 #define VelAlta 300 00107 #define VelMedia 200 00108 #define VelBaja 100 00109 00110 00111 //****************************************************************************** 00112 // COMANDOS 00113 00114 #define iniciar_telemetria 0xFE 00115 #define iniciar_telecomando 0xFF 00116 00117 #define telemetria_1 0x01 // 00118 #define telemcomando_1 0x01 00119 00120 #define C_LeerColor 0x00 00121 #define C_Sonido1 0x01 00122 #define C_Sonido2 0x02 00123 #define C_Sonido3 0x03 00124 #define C_Sonido4 0x04 00125 #define C_Adelante 0x05 00126 #define C_Atras 0x06 00127 #define C_Izquierda 0x07 00128 #define C_Derecha 0x08 00129 #define C_Velocidad 0x09 00130 #define C_Joistck 0x0A 00131 00132 int comando_joystick = 0; 00133 00134 00135 // variables y constantes del Joystick 00136 00137 uint8_t estado_x; 00138 uint8_t estado_y; 00139 #define E_Derecha 1 00140 #define E_Izquier 0 00141 #define E_Adelante 1 00142 #define E_Atras 0 00143 #define E_Centro 3 00144 #define Lim_JKIn 150 00145 #define Lim_JKSup 180 00146 00147 00148 00149 // Variables y constantes pulsador 00150 volatile bool button1_pressed = false; // Used in the main loop 00151 volatile bool button1_enabled = true; // Used for debouncing 00152 Timeout button1_timeout; // Used for debouncing 00153 00154 00155 00156 bool ComandPend = true; 00157 00158 //**************************************************************************** 00159 // Prototipo de funciones 00160 void Configuracion_Inicial(void); 00161 void ReadPort(void); // Lee el puerto Serial 00162 void MainConfig(void); // Configuracion Inicial de los Perifericos del uC 00163 void Buzzer_Tone(uint8_t tipo_tono, uint8_t duracion_tono); // configura el tono y la duracion escuchada a travez del Buzzer 00164 void leer_color(void); // funcion que retorna los componentes 00165 // RGB y Clear del color leido 00166 void leer_Joystick(void); // Ejerce control sobre el Movimiento del carro desde el Joistick 00167 void intTimeBuzzer(void); 00168 00169 void button1_enabled_cb(void); 00170 void button1_onpressed_cb(void); 00171 00172 00173 //**************************************************************************** 00174 // 00175 00176 /// Variables y constantes para la TFT 00177 00178 const unsigned short FOREGROUND_COLORS[] = {White, Cyan, Red, Magenta, Yellow, Orange, GreenYellow}; 00179 const unsigned short BACKGROUND_COLORS[] = {Black, Green, Yellow, Blue, Magenta, Black, Red}; 00180 unsigned short backgroundColor; 00181 unsigned short foregroundColor; 00182 unsigned short colorIndex = 0; 00183 char orient = 1; 00184 00185 00186 void Configuracion_Inicial() 00187 { 00188 00189 Buzzer.write(0); // configura el ciclo util 00190 Motores.StepFreq(VelMedia); // Valor inicial de velocidad = Media 00191 CoolTerm.attach(&ReadPort, Serial::RxIrq); // Se Habilita la interrupcion serial o recepcion de datos 00192 //MuestrearCOLOR.attach(&leer_color, 0.6); // Se Habilita una interrupcion cada 0.6 Segundos para leer el color 00193 tft = new ILI9341(SPI_8, 10000000, PC_12, PC_11, PC_10, PA_13, PA_14, PA_15, "tft"); // SPI type, SPI speed, mosi, miso, sclk, cs, reset, dc 00194 tft->set_orientation(orient); // horizontal 1 00195 00196 CoolTerm.baud(115200); 00197 //CoolTerm.printf("\n\nSystem Core Clock = %.3f MHZ\r\n",(float)SystemCoreClock/1000000); 00198 //tft->printf("\n\nSystem Core Clock = %.3f MHZ\r\n",(float)SystemCoreClock/1000000); 00199 foregroundColor = FOREGROUND_COLORS[0]; // white 00200 backgroundColor = BACKGROUND_COLORS[0];// DarkCyan 00201 00202 tft->background(backgroundColor); // set background to black 00203 tft->set_orientation(orient); 00204 tft->cls(); // clear the screen 00205 00206 00207 00208 00209 00210 tft->set_font((unsigned char*) Arial24x23,32,127,false); //variable width disabled 00211 tft->locate(80,80); 00212 tft->printf("COLOR \n\t\t NO \n\tIDENTIFICADO \r\n"); 00213 00214 00215 //button1.mode(PullUp); // Activate pull-up 00216 button1.fall(callback(button1_onpressed_cb)); // Attach ISR to handle button press event 00217 00218 00219 } 00220 00221 00222 00223 00224 00225 00226 // Enables button when bouncing is over 00227 void button1_enabled_cb(void) 00228 { 00229 button1_enabled = true; 00230 if (button1_enabled) 00231 { 00232 // Reinicializamos nuestras variables de control a sus valores iniciales 00233 // Para no seguir entrando a las sentencias IF 00234 programa_ejecutar = 0; 00235 coolterm_data = 0; 00236 ComandoRecivido = valorInicial; 00237 Parametro = valorInicial; 00238 Motores.Stop(); 00239 TimeBuzzer.attach(&intTimeBuzzer, 0); 00240 ComandPend = false; 00241 } 00242 } 00243 00244 // ISR handling button pressed event 00245 void button1_onpressed_cb(void) 00246 { 00247 if (button1_enabled) 00248 { // Disabled while the button is bouncing 00249 button1_enabled = false; 00250 button1_pressed = true; // To be read by the main loop 00251 button1_timeout.attach(callback(button1_enabled_cb), 0.3); // Debounce time 300 ms 00252 } 00253 00254 00255 00256 } 00257 00258 00259 00260 00261 void ReadPort() 00262 { 00263 uint8_t temp = CoolTerm.getc(); 00264 //if(CoolTerm.writable()) CoolTerm.abort_write(); // ELIMINA LO QUE ESTEMOS ESCRIBIENDO AL COOLTERM 00265 if (ComandPend == true) 00266 { 00267 switch(n_interrupcion) 00268 { 00269 case 00: coolterm_data = temp; 00270 if (coolterm_data == iniciar_telecomando) 00271 n_interrupcion = 1; 00272 break; 00273 case 01: ComandoRecivido = temp; 00274 n_interrupcion=2; 00275 break; 00276 case 02: Parametro = temp; 00277 n_interrupcion = 0; 00278 ComandPend=false; 00279 break; 00280 00281 } 00282 00283 } 00284 00285 00286 } 00287 00288 ///******************************************+ 00289 00290 00291 void leer_Joystick() 00292 { 00293 00294 /// Variables Joystick 00295 float EjeX; 00296 float EjeY; 00297 float Vx; 00298 float Vy; 00299 00300 while ( ComandPend == true ) 00301 { 00302 00303 EjeX = JEjeX.read(); 00304 Vx = EjeX * 3300; 00305 wait (0.1); 00306 EjeY = JEjeY.read(); 00307 Vy = EjeY * 3300; 00308 00309 // CoolTerm.printf ("ejex: %f ejey: %f Vx: %f Vy: %f \n ", EjeX, EjeY, Vx, Vy); 00310 00311 if(int(Vx/10) > Lim_JKIn && int(Vx/10) < Lim_JKSup) {estado_x = E_Centro; }//(CoolTerm.printf ("Estado X Centro \n"); } 00312 if(int(Vy/10) > Lim_JKIn && int(Vy/10) < Lim_JKSup) {estado_y = E_Centro; }//CoolTerm.printf ("Estado Y Centro \n"); } 00313 00314 if(int(Vx/10) > Lim_JKSup && estado_y == E_Centro){ estado_x = E_Izquier; }// CoolTerm.printf ("Estado X Izquierda\n"); } 00315 if(int(Vy/10) > Lim_JKSup && estado_x == E_Centro){ estado_y = E_Atras; }// CoolTerm.printf ("Estado Y Adelante\n"); } 00316 00317 if(int(Vx/10) < Lim_JKIn && estado_y == E_Centro){ estado_x = E_Derecha; } //CoolTerm.printf ("Estado X Derecha\n"); } 00318 if(int(Vy/10) < Lim_JKIn && estado_x == E_Centro){ estado_y = E_Adelante; } //CoolTerm.printf ("Estado Y Atras\n"); } 00319 00320 00321 // Combinacion de estados para STOP 00322 if( estado_x == E_Centro && estado_y == E_Centro){ Motores.Stop(); }//CoolTerm.printf ("MOTORES STOP\n"); } 00323 00324 // Combinacion de estados para ADELANTE 00325 if(estado_x == E_Centro && estado_y == E_Adelante) { Motores.Back(); Motores.Run(0.5); }// CoolTerm.printf ("MOTORES BACK\n"); } 00326 00327 // Combinacion de estados para ATRAS 00328 if(estado_x == E_Centro && estado_y == E_Atras) { Motores.Forward(); Motores.Run(0.5); }// CoolTerm.printf ("MOTORES FORWARD\n"); } 00329 00330 00331 // Combinacion de estados para DERECHA 00332 if(estado_y == E_Centro && estado_x == E_Derecha) { Motores.Giro(15, false); Motores.Run(0.5); } // CoolTerm.printf ("MOTORES DERECHA\n"); } 00333 00334 // Combinacion de estados para IZQUIERDA 00335 if(estado_y == E_Centro && estado_x == E_Izquier) { Motores.Giro(15, true); Motores.Run(0.5); } // CoolTerm.printf ("MOTORES IZQUIERDA\n"); } 00336 //wait(1.5); 00337 00338 if (ComandoRecivido == C_Joistck && Parametro == 0x02) break; 00339 } 00340 00341 00342 } 00343 00344 00345 00346 int main() 00347 { 00348 00349 Configuracion_Inicial(); 00350 00351 MuestrearCOLOR.attach(&leer_color, 1.5); // Se Habilita una interrupcion cada 0.6 Segundos para leer el color 00352 00353 while(1) 00354 { 00355 00356 /// Espera hasta que no se tengan comandos pendientes 00357 while(ComandPend == true)wait_ms(1); 00358 ComandPend = true; 00359 00360 00361 // Desactivamos la interrupcion serial o recepcion de datos PORQUE NO NECESITAMOS recibir mas datos por AHORA 00362 // CoolTerm.attach(NULL, Serial::RxIrq); 00363 00364 switch(ComandoRecivido) 00365 { 00366 00367 //case C_LeerColor: // Ejecutamos la Funcion LeerColor(); 00368 // leer_color(); 00369 //break; 00370 case C_Sonido1: //CoolTerm.printf("SONIDO 1\n"); 00371 duracion_tono = Parametro; // lo almacenamos en: duracion_tono 00372 tipo_tono = TONO_DO; 00373 Buzzer_Tone(tipo_tono, duracion_tono); 00374 break; 00375 case C_Sonido2: //CoolTerm.printf("SONIDO 2\n"); 00376 duracion_tono = Parametro; // lo almacenamos en: duracion_tono 00377 tipo_tono = TONO_RE; 00378 Buzzer_Tone(tipo_tono, duracion_tono); 00379 break; 00380 case C_Sonido3: //CoolTerm.printf("SONIDO 3\n"); 00381 duracion_tono = Parametro; // lo almacenamos en: duracion_tono 00382 tipo_tono = TONO_MI; 00383 Buzzer_Tone(tipo_tono, duracion_tono); 00384 break; 00385 case C_Sonido4: //CoolTerm.printf("SONIDO 4\n"); 00386 duracion_tono = Parametro; // lo almacenamos en: duracion_tono 00387 tipo_tono = TONO_SI; 00388 Buzzer_Tone(tipo_tono, duracion_tono); 00389 break; 00390 case C_Adelante: Motores.Forward(); Motores.RunRound(Parametro); 00391 break; 00392 case C_Atras: Motores.Back(); Motores.RunRound(Parametro); 00393 break; 00394 case C_Izquierda: Motores.Giro(65, true); 00395 break; 00396 case C_Derecha: Motores.Giro(65, false); 00397 break; 00398 case C_Velocidad: if(Parametro == 0x01)Motores.StepFreq(VelBaja); 00399 if(Parametro == 0x02)Motores.StepFreq(VelMedia); 00400 if(Parametro == 0x03)Motores.StepFreq(VelAlta); 00401 break; 00402 case C_Joistck: leer_Joystick(); 00403 break; 00404 default: break; 00405 00406 00407 } 00408 00409 00410 // Reinicializamos nuestras variables de control a sus valores iniciales 00411 // Para no seguir entrando a las sentencias IF 00412 if(ComandPend == true) 00413 { 00414 programa_ejecutar = 0; 00415 coolterm_data = 0; 00416 ComandoRecivido = valorInicial; Parametro = valorInicial; 00417 00418 } 00419 00420 //// HABILITAMOS NUEVAMENTE la interrupcion serial o recepcion de datos 00421 // CoolTerm.attach(&ReadPort, Serial::RxIrq); 00422 00423 } 00424 00425 } 00426 00427 00428 00429 void Buzzer_Tone(uint8_t tipo_tono, uint8_t duracion_tono) 00430 { 00431 00432 00433 switch (tipo_tono) 00434 { 00435 00436 case TONO_DO: Buzzer.period_ms(DO); 00437 //CoolTerm.printf("Tono Seleccionado DO!!\n"); 00438 00439 break; // salimos del SWITCH 00440 00441 case TONO_RE: Buzzer.period_ms(RE); 00442 //CoolTerm.printf("Tono Seleccionado RE!!\n"); 00443 00444 break; // salimos del SWITCH 00445 00446 case TONO_MI: Buzzer.period_ms(MI); 00447 //CoolTerm.printf("Tono Seleccionado MI!!\n"); 00448 00449 break; // salimos del SWITCH 00450 00451 case TONO_SI: Buzzer.period_ms(SI); 00452 //CoolTerm.printf("Tono Seleccionado SI!!\n"); 00453 00454 break; // salimos del SWITCH 00455 00456 // si no fue ninguno de los valores anteriores entonces: 00457 default: //CoolTerm.printf("teleComando desconocido, inicie nuevamente !!\n"); 00458 00459 break; // salimos del SWITCH 00460 00461 } 00462 00463 // COMO EL CICLO UTIL DEL BUZZER ESTABA EN 0, POR LO CUAL NO SONABA 00464 // SE PONE AL 50% DEL PERIODO 00465 Buzzer.write(0.5); 00466 // SE ESPERA DURANTE EN TIEMPO INGRESADO (EN SEGUNDOS ) 00467 // wait(duracion_tono); 00468 00469 TimeBuzzer.attach(&intTimeBuzzer, duracion_tono); 00470 00471 // Se Reinicializa el Periodo y el Ciclo útil de la señal PWM 00472 // que va al Buzzer 00473 // Buzzer.period_ms(1); 00474 // Buzzer.write(0); 00475 00476 00477 00478 } 00479 00480 00481 00482 void intTimeBuzzer(void) 00483 { 00484 00485 // Se Reinicializa el Periodo y el Ciclo útil de la señal PWM 00486 // que va al Buzzer 00487 Buzzer.period_ms(1); 00488 Buzzer.write(0); 00489 00490 00491 } 00492 00493 00494 void leer_color() 00495 { 00496 MuestrearCOLOR.attach(NULL, 1.5); // Se Habilita una interrupcion cada 0.6 Segundos para leer el color 00497 00498 red = SENSOR_COLOR.ReadRed(); // OBTENEMOS EL TIEMPO DEL CICLO UTIL DE LA FRECUENCIA DE SALIDA 00499 green = SENSOR_COLOR.ReadGreen(); 00500 blue = SENSOR_COLOR.ReadBlue(); 00501 clear = SENSOR_COLOR.ReadClear(); 00502 00503 //printf("RED: %5d GREEN: %5d BLUE: %5d CLEAR: %5d \n ", red, green, blue, clear); 00504 00505 red *= 2; // Calculamos EL PERIODO de la frecuencia generada por la lectura del fotodiodo rojo 00506 blue *= 2; // Calculamos EL PERIODO de la frecuencia generada por la lectura del fotodiodo rojo 00507 green *= 2; // Calculamos EL PERIODO de la frecuencia generada por la lectura del fotodiodo rojo 00508 clear *= 2; // Calculamos EL PERIODO de la frecuencia generada por la lectura del fotodiodo rojo 00509 00510 //printf("RED: %5d GREEN: %5d BLUE: %5d CLEAR: %5d \n ", red, green, blue, clear); 00511 00512 00513 ////////////////////////////////////////////////////////////// 00514 //// identificar azul 00515 00516 00517 if(red <=42 && red >=24) 00518 { 00519 if(green >= 20 && green <= 28 ) 00520 { 00521 if(blue >= 10 && blue <= 16) 00522 { 00523 color_identificado = CMD_azul; 00524 CoolTerm.putc( iniciar_telemetria); 00525 CoolTerm.putc( CMD_azul ); 00526 if (color_anterior != CMD_azul) 00527 { 00528 foregroundColor = FOREGROUND_COLORS[0]; // white 00529 backgroundColor = BACKGROUND_COLORS[3];// DarkCyan 00530 tft->background(backgroundColor); // set background to black 00531 tft->set_font((unsigned char*) Arial24x23,32,127,false); //variable width disabled 00532 tft->cls(); 00533 tft->locate(80,80); 00534 tft->printf("COLOR \n\tAZUL\r\n"); 00535 00536 } 00537 color_anterior = CMD_azul; 00538 00539 } 00540 } 00541 } 00542 00543 00544 00545 00546 ///////////////////////////////////////////////////////////// 00547 /// identificar rojo 00548 if(red <= 12 ) 00549 { 00550 if(green >= 10 && green <= 28 ) 00551 { 00552 if(blue >= 18 && blue <= 24) 00553 { 00554 color_identificado = CMD_rojo; 00555 CoolTerm.putc( iniciar_telemetria); 00556 CoolTerm.putc( CMD_rojo ); 00557 00558 if (color_anterior != CMD_rojo) 00559 { 00560 foregroundColor = FOREGROUND_COLORS[0]; // white 00561 backgroundColor = BACKGROUND_COLORS[6];// DarkCyan 00562 tft->background(backgroundColor); // set background to black 00563 tft->set_font((unsigned char*) Arial24x23,32,127,false); //variable width disabled 00564 tft->cls(); 00565 tft->locate(80,80); 00566 tft->printf("COLOR \n\tROJO\r\n"); 00567 } 00568 color_anterior = CMD_rojo; 00569 } 00570 } 00571 00572 if(green < 10 && green >= 6 ) 00573 { 00574 if(blue <= 12 ) 00575 { 00576 color_identificado = CMD_clear; 00577 CoolTerm.putc( iniciar_telemetria); 00578 CoolTerm.putc( CMD_clear ); 00579 if (color_anterior != CMD_clear) 00580 { 00581 foregroundColor = FOREGROUND_COLORS[0]; // white 00582 backgroundColor = BACKGROUND_COLORS[2];// DarkCyan 00583 tft->background(backgroundColor); // set background to black 00584 tft->set_font((unsigned char*) Arial24x23,32,127,false); //variable width disabled 00585 tft->cls(); 00586 tft->locate(80,80); 00587 tft->printf("COLOR \n\tAMARILLO\r\n"); 00588 } 00589 color_anterior = CMD_clear; 00590 00591 } 00592 00593 } 00594 00595 } 00596 00597 00598 if(green >= 36 && green <= 44 ) 00599 { 00600 if(red >= 40 && red <= 50 ) 00601 00602 { 00603 color_identificado = CMD_verde; 00604 CoolTerm.putc( iniciar_telemetria); 00605 CoolTerm.putc( CMD_verde ); 00606 if (color_anterior != CMD_verde) 00607 { 00608 foregroundColor = FOREGROUND_COLORS[0]; // white 00609 backgroundColor = BACKGROUND_COLORS[1];// DarkCyan 00610 tft->background(backgroundColor); // set background to black 00611 tft->set_font((unsigned char*) Arial24x23,32,127,false); //variable width disabled 00612 tft->cls(); 00613 tft->locate(80,80); 00614 tft->printf("COLOR \n\tVERDE\r\n"); 00615 } 00616 color_anterior = CMD_verde; 00617 } 00618 } 00619 00620 if (color_identificado == ColorNoIdentificado) 00621 { 00622 00623 00624 CoolTerm.putc( iniciar_telemetria); 00625 CoolTerm.putc( ColorNoIdentificado); 00626 00627 if (color_anterior != ColorNoIdentificado) 00628 { 00629 foregroundColor = FOREGROUND_COLORS[0]; // white 00630 backgroundColor = BACKGROUND_COLORS[5];// DarkCyan 00631 tft->background(backgroundColor); // set background to black 00632 tft->set_font((unsigned char*) Arial24x23,32,127,false); //variable width disabled 00633 tft->cls(); 00634 tft->locate(80,80); 00635 tft->printf("COLOR \n\t\t NO \n\tIDENTIFICADO \r\n"); 00636 } 00637 color_anterior = ColorNoIdentificado; 00638 00639 } 00640 00641 color_identificado = ColorNoIdentificado; 00642 00643 MuestrearCOLOR.attach(&leer_color, 1.5); // Se Habilita una interrupcion cada 0.6 Segundos para leer el color 00644 } 00645 00646 00647
Generated on Sun Aug 21 2022 11:57:35 by
1.7.2