Firmware para placa Praxis
Dependencies: mbed BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG
main.cpp@3:b12ac8d9c397, 2017-09-19 (annotated)
- Committer:
- DiegoColl
- Date:
- Tue Sep 19 20:54:07 2017 +0000
- Revision:
- 3:b12ac8d9c397
- Parent:
- 2:997b65c65e65
praxis 0.1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DiegoColl | 0:9cac1b16cf93 | 1 | #include "mbed.h" |
DiegoColl | 1:6e255a933812 | 2 | #include "TS_DISCO_F746NG.h" |
DiegoColl | 1:6e255a933812 | 3 | #include "LCD_DISCO_F746NG.h" |
DiegoColl | 2:997b65c65e65 | 4 | //#include "EthernetInterface.h" |
DiegoColl | 0:9cac1b16cf93 | 5 | |
DiegoColl | 0:9cac1b16cf93 | 6 | //-------------------------------------------- definicion de uarts |
DiegoColl | 0:9cac1b16cf93 | 7 | |
DiegoColl | 3:b12ac8d9c397 | 8 | Serial pc(USBTX, USBRX); //activar para manejar las dos conexiones uart.(no olvidar ordenar los cambios) |
DiegoColl | 0:9cac1b16cf93 | 9 | |
DiegoColl | 3:b12ac8d9c397 | 10 | //Serial uart(USBTX, USBRX); //cambiar por el de abajo a la ahora de cargarlo en la placa, para testear con los modulos. |
DiegoColl | 3:b12ac8d9c397 | 11 | Serial uart(PC_6, PC_7); |
DiegoColl | 0:9cac1b16cf93 | 12 | |
DiegoColl | 0:9cac1b16cf93 | 13 | |
DiegoColl | 0:9cac1b16cf93 | 14 | //-------------------------------------------- definicion de etiquetas |
DiegoColl | 0:9cac1b16cf93 | 15 | |
DiegoColl | 1:6e255a933812 | 16 | LCD_DISCO_F746NG lcd; |
DiegoColl | 1:6e255a933812 | 17 | TS_DISCO_F746NG ts; |
DiegoColl | 2:997b65c65e65 | 18 | |
DiegoColl | 0:9cac1b16cf93 | 19 | InterruptIn button(BUTTON1); |
DiegoColl | 0:9cac1b16cf93 | 20 | DigitalOut myled(LED1); |
DiegoColl | 0:9cac1b16cf93 | 21 | |
DiegoColl | 0:9cac1b16cf93 | 22 | //-------------------------------------------- definicion de variables globales |
DiegoColl | 0:9cac1b16cf93 | 23 | |
DiegoColl | 2:997b65c65e65 | 24 | //const char* ECHO_SERVER_ADDRESS = "192.168.2.2"; |
DiegoColl | 2:997b65c65e65 | 25 | //const int ECHO_SERVER_PORT = 7; |
DiegoColl | 2:997b65c65e65 | 26 | |
DiegoColl | 3:b12ac8d9c397 | 27 | char ID[3]="C1"; |
DiegoColl | 3:b12ac8d9c397 | 28 | char ST[3]="OK"; |
DiegoColl | 3:b12ac8d9c397 | 29 | char AC[3]=""; |
DiegoColl | 3:b12ac8d9c397 | 30 | char AK[3]=""; |
DiegoColl | 3:b12ac8d9c397 | 31 | |
DiegoColl | 0:9cac1b16cf93 | 32 | //char IDs[]="",STs[]="",ACs[]="",AKs[]=""; |
DiegoColl | 0:9cac1b16cf93 | 33 | |
DiegoColl | 0:9cac1b16cf93 | 34 | char buffer[32]=""; |
DiegoColl | 1:6e255a933812 | 35 | char* aux[10]; |
DiegoColl | 3:b12ac8d9c397 | 36 | |
DiegoColl | 3:b12ac8d9c397 | 37 | unsigned int L=0; |
DiegoColl | 3:b12ac8d9c397 | 38 | |
DiegoColl | 3:b12ac8d9c397 | 39 | uint8_t text[30]; |
DiegoColl | 3:b12ac8d9c397 | 40 | |
DiegoColl | 1:6e255a933812 | 41 | //char* acc[4]={"CN","DT","OK","ER"}; |
DiegoColl | 0:9cac1b16cf93 | 42 | int SP=1; |
DiegoColl | 0:9cac1b16cf93 | 43 | int OP=1; |
DiegoColl | 1:6e255a933812 | 44 | int x=0; |
DiegoColl | 1:6e255a933812 | 45 | int yx=72, yy=142, yz=212; |
DiegoColl | 1:6e255a933812 | 46 | int gx=72, gy=142, gz=212; |
DiegoColl | 1:6e255a933812 | 47 | int mx=72, my=142, mz=212; |
DiegoColl | 1:6e255a933812 | 48 | |
DiegoColl | 0:9cac1b16cf93 | 49 | |
DiegoColl | 0:9cac1b16cf93 | 50 | //-------------------------------------------- definicion de funciones |
DiegoColl | 0:9cac1b16cf93 | 51 | |
DiegoColl | 3:b12ac8d9c397 | 52 | void first_connection(){ |
DiegoColl | 3:b12ac8d9c397 | 53 | |
DiegoColl | 3:b12ac8d9c397 | 54 | //------------------------------ programa |
DiegoColl | 3:b12ac8d9c397 | 55 | |
DiegoColl | 3:b12ac8d9c397 | 56 | if(strcmp(aux[2],"CN") == 0){ |
DiegoColl | 3:b12ac8d9c397 | 57 | uart.printf("<C1;OK;YE;51>"); |
DiegoColl | 3:b12ac8d9c397 | 58 | //time.start(); |
DiegoColl | 3:b12ac8d9c397 | 59 | } |
DiegoColl | 3:b12ac8d9c397 | 60 | } |
DiegoColl | 3:b12ac8d9c397 | 61 | |
DiegoColl | 3:b12ac8d9c397 | 62 | |
DiegoColl | 3:b12ac8d9c397 | 63 | |
DiegoColl | 1:6e255a933812 | 64 | void encabezado_lcd(){ |
DiegoColl | 1:6e255a933812 | 65 | |
DiegoColl | 1:6e255a933812 | 66 | //------------------------------ programa |
DiegoColl | 1:6e255a933812 | 67 | |
DiegoColl | 1:6e255a933812 | 68 | lcd.Clear(LCD_COLOR_BLACK); |
DiegoColl | 1:6e255a933812 | 69 | lcd.SetBackColor(LCD_COLOR_BLACK); |
DiegoColl | 1:6e255a933812 | 70 | lcd.SetTextColor(LCD_COLOR_GREEN); |
DiegoColl | 1:6e255a933812 | 71 | lcd.DisplayStringAt(0, LINE(5), (uint8_t *)"PRAXIS", CENTER_MODE); |
DiegoColl | 1:6e255a933812 | 72 | wait(3); // 3s |
DiegoColl | 1:6e255a933812 | 73 | lcd.Clear(LCD_COLOR_BLACK); |
DiegoColl | 1:6e255a933812 | 74 | }; |
DiegoColl | 1:6e255a933812 | 75 | |
DiegoColl | 1:6e255a933812 | 76 | void refrescar_lcd(){ |
DiegoColl | 1:6e255a933812 | 77 | |
DiegoColl | 1:6e255a933812 | 78 | //------------------------------ programa |
DiegoColl | 1:6e255a933812 | 79 | |
DiegoColl | 1:6e255a933812 | 80 | lcd.SetTextColor(LCD_COLOR_GREEN); |
DiegoColl | 1:6e255a933812 | 81 | lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"PRAXIS", CENTER_MODE); |
DiegoColl | 1:6e255a933812 | 82 | |
DiegoColl | 1:6e255a933812 | 83 | x++; |
DiegoColl | 1:6e255a933812 | 84 | if(x==480){ |
DiegoColl | 1:6e255a933812 | 85 | x=0; |
DiegoColl | 1:6e255a933812 | 86 | lcd.Clear(LCD_COLOR_BLACK); |
DiegoColl | 1:6e255a933812 | 87 | } |
DiegoColl | 1:6e255a933812 | 88 | |
DiegoColl | 1:6e255a933812 | 89 | lcd.DrawPixel(x, yx, LCD_COLOR_ORANGE); |
DiegoColl | 1:6e255a933812 | 90 | lcd.DrawPixel(x, yy, LCD_COLOR_YELLOW); |
DiegoColl | 1:6e255a933812 | 91 | lcd.DrawPixel(x, yz, LCD_COLOR_RED); |
DiegoColl | 1:6e255a933812 | 92 | |
DiegoColl | 1:6e255a933812 | 93 | wait(0.01); // 10 ms |
DiegoColl | 1:6e255a933812 | 94 | }; |
DiegoColl | 1:6e255a933812 | 95 | |
DiegoColl | 0:9cac1b16cf93 | 96 | void blinkled(){ |
DiegoColl | 0:9cac1b16cf93 | 97 | myled = 1; // LED is ON |
DiegoColl | 0:9cac1b16cf93 | 98 | wait(0.2); // 200 ms |
DiegoColl | 0:9cac1b16cf93 | 99 | myled = 0; // LED is OFF |
DiegoColl | 0:9cac1b16cf93 | 100 | wait(0.2); // 200 ms |
DiegoColl | 0:9cac1b16cf93 | 101 | }; |
DiegoColl | 0:9cac1b16cf93 | 102 | |
DiegoColl | 0:9cac1b16cf93 | 103 | void speed(){ |
DiegoColl | 0:9cac1b16cf93 | 104 | |
DiegoColl | 0:9cac1b16cf93 | 105 | //------------ variables locales |
DiegoColl | 0:9cac1b16cf93 | 106 | |
DiegoColl | 0:9cac1b16cf93 | 107 | |
DiegoColl | 0:9cac1b16cf93 | 108 | //------------ programa |
DiegoColl | 0:9cac1b16cf93 | 109 | |
DiegoColl | 3:b12ac8d9c397 | 110 | uart.printf("<C1;OK;S%i;2F>",SP); |
DiegoColl | 0:9cac1b16cf93 | 111 | |
DiegoColl | 0:9cac1b16cf93 | 112 | SP++; |
DiegoColl | 0:9cac1b16cf93 | 113 | |
DiegoColl | 0:9cac1b16cf93 | 114 | if(SP==4){ |
DiegoColl | 0:9cac1b16cf93 | 115 | SP=1; |
DiegoColl | 0:9cac1b16cf93 | 116 | } |
DiegoColl | 0:9cac1b16cf93 | 117 | }; |
DiegoColl | 0:9cac1b16cf93 | 118 | |
DiegoColl | 0:9cac1b16cf93 | 119 | void borrar_buffer(char *cadena){ |
DiegoColl | 0:9cac1b16cf93 | 120 | |
DiegoColl | 0:9cac1b16cf93 | 121 | //------------ variables locales |
DiegoColl | 0:9cac1b16cf93 | 122 | |
DiegoColl | 0:9cac1b16cf93 | 123 | int i=0; |
DiegoColl | 0:9cac1b16cf93 | 124 | |
DiegoColl | 0:9cac1b16cf93 | 125 | //------------ programa |
DiegoColl | 0:9cac1b16cf93 | 126 | |
DiegoColl | 0:9cac1b16cf93 | 127 | for(i=0;i<31;i++){ |
DiegoColl | 3:b12ac8d9c397 | 128 | //pc.putc(cadena[i]); |
DiegoColl | 0:9cac1b16cf93 | 129 | cadena[i]=0x00; |
DiegoColl | 3:b12ac8d9c397 | 130 | |
DiegoColl | 0:9cac1b16cf93 | 131 | } |
DiegoColl | 0:9cac1b16cf93 | 132 | }; |
DiegoColl | 0:9cac1b16cf93 | 133 | |
DiegoColl | 0:9cac1b16cf93 | 134 | void interrup(){ |
DiegoColl | 0:9cac1b16cf93 | 135 | |
DiegoColl | 0:9cac1b16cf93 | 136 | //------------ variables locales |
DiegoColl | 0:9cac1b16cf93 | 137 | |
DiegoColl | 1:6e255a933812 | 138 | char chksm=0; |
DiegoColl | 0:9cac1b16cf93 | 139 | char c; |
DiegoColl | 0:9cac1b16cf93 | 140 | int i=0; |
DiegoColl | 0:9cac1b16cf93 | 141 | |
DiegoColl | 0:9cac1b16cf93 | 142 | //------------ programa |
DiegoColl | 0:9cac1b16cf93 | 143 | |
DiegoColl | 0:9cac1b16cf93 | 144 | c=uart.getc(); |
DiegoColl | 0:9cac1b16cf93 | 145 | if(c=='<'){ |
DiegoColl | 0:9cac1b16cf93 | 146 | while(c!='>'){ |
DiegoColl | 0:9cac1b16cf93 | 147 | c=uart.getc(); |
DiegoColl | 0:9cac1b16cf93 | 148 | if(c!='>'){ |
DiegoColl | 1:6e255a933812 | 149 | buffer[i++]=c; //------------ carga buffer |
DiegoColl | 0:9cac1b16cf93 | 150 | } |
DiegoColl | 0:9cac1b16cf93 | 151 | } |
DiegoColl | 1:6e255a933812 | 152 | |
DiegoColl | 1:6e255a933812 | 153 | for(i=0;i<strlen(buffer)-2;i++){ //------------ calculo checksum |
DiegoColl | 1:6e255a933812 | 154 | chksm ^= buffer[i]; |
DiegoColl | 1:6e255a933812 | 155 | } |
DiegoColl | 1:6e255a933812 | 156 | |
DiegoColl | 1:6e255a933812 | 157 | //uart.printf("%x",chksm); |
DiegoColl | 1:6e255a933812 | 158 | |
DiegoColl | 0:9cac1b16cf93 | 159 | i=0; |
DiegoColl | 1:6e255a933812 | 160 | |
DiegoColl | 1:6e255a933812 | 161 | aux[i]=strtok(buffer,";"); //------------ separa la cadena |
DiegoColl | 1:6e255a933812 | 162 | |
DiegoColl | 0:9cac1b16cf93 | 163 | do{ |
DiegoColl | 3:b12ac8d9c397 | 164 | //pc.puts(aux[i]); |
DiegoColl | 3:b12ac8d9c397 | 165 | //pc.putc('-'); |
DiegoColl | 0:9cac1b16cf93 | 166 | i++; |
DiegoColl | 0:9cac1b16cf93 | 167 | aux[i]=strtok(NULL, ";"); |
DiegoColl | 0:9cac1b16cf93 | 168 | }while(aux[i]!=NULL); |
DiegoColl | 3:b12ac8d9c397 | 169 | |
DiegoColl | 1:6e255a933812 | 170 | |
DiegoColl | 1:6e255a933812 | 171 | //if(strcmp(aux[??],chksm) == 0){ //------------ comparar checksum (FALTA) |
DiegoColl | 3:b12ac8d9c397 | 172 | // pc.printf("checksum igual"); |
DiegoColl | 1:6e255a933812 | 173 | // } |
DiegoColl | 1:6e255a933812 | 174 | |
DiegoColl | 1:6e255a933812 | 175 | |
DiegoColl | 3:b12ac8d9c397 | 176 | if(strcmp(aux[0],"T1") == 0){ //------------ tipo de sensor TIMER |
DiegoColl | 3:b12ac8d9c397 | 177 | if(strcmp(aux[2],"CN") == 0){ |
DiegoColl | 3:b12ac8d9c397 | 178 | uart.printf("<C1;OK;YE;51>"); |
DiegoColl | 3:b12ac8d9c397 | 179 | lcd.Clear(LCD_COLOR_BLACK); |
DiegoColl | 3:b12ac8d9c397 | 180 | lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"TIMER", CENTER_MODE); |
DiegoColl | 3:b12ac8d9c397 | 181 | //time.start(); |
DiegoColl | 3:b12ac8d9c397 | 182 | } |
DiegoColl | 3:b12ac8d9c397 | 183 | |
DiegoColl | 3:b12ac8d9c397 | 184 | if(strcmp(aux[2],"D1") == 0){ |
DiegoColl | 3:b12ac8d9c397 | 185 | |
DiegoColl | 3:b12ac8d9c397 | 186 | |
DiegoColl | 3:b12ac8d9c397 | 187 | lcd.DisplayStringAt(0, LINE(2+L), (uint8_t *) "Tiempo:", LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 188 | lcd.DisplayStringAt(130, LINE(2+L), (uint8_t *) aux[3], LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 189 | lcd.DisplayStringAt(160, LINE(2+L), (uint8_t *) ":", LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 190 | lcd.DisplayStringAt(170, LINE(2+L), (uint8_t *) aux[4], LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 191 | lcd.DisplayStringAt(200, LINE(2+L), (uint8_t *) ":", LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 192 | lcd.DisplayStringAt(210, LINE(2+L), (uint8_t *) aux[5], LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 193 | |
DiegoColl | 3:b12ac8d9c397 | 194 | L = L + 1; |
DiegoColl | 3:b12ac8d9c397 | 195 | |
DiegoColl | 3:b12ac8d9c397 | 196 | if(L==9){ |
DiegoColl | 3:b12ac8d9c397 | 197 | L=0; |
DiegoColl | 3:b12ac8d9c397 | 198 | } |
DiegoColl | 3:b12ac8d9c397 | 199 | } |
DiegoColl | 3:b12ac8d9c397 | 200 | } |
DiegoColl | 1:6e255a933812 | 201 | |
DiegoColl | 3:b12ac8d9c397 | 202 | if(strcmp(aux[0],"A1") == 0){ //------------ tipo de sensor TIMER |
DiegoColl | 3:b12ac8d9c397 | 203 | if(strcmp(aux[2],"CN") == 0){ |
DiegoColl | 3:b12ac8d9c397 | 204 | uart.printf("<C1;OK;YE;51>"); |
DiegoColl | 3:b12ac8d9c397 | 205 | lcd.Clear(LCD_COLOR_BLACK); |
DiegoColl | 3:b12ac8d9c397 | 206 | //lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"ACEL - GIRO - MAG", CENTER_MODE); |
DiegoColl | 3:b12ac8d9c397 | 207 | //time.start(); |
DiegoColl | 3:b12ac8d9c397 | 208 | } |
DiegoColl | 3:b12ac8d9c397 | 209 | |
DiegoColl | 3:b12ac8d9c397 | 210 | if(strcmp(aux[2],"D1") == 0){ |
DiegoColl | 3:b12ac8d9c397 | 211 | lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"ACELEROMETRO", CENTER_MODE); |
DiegoColl | 3:b12ac8d9c397 | 212 | |
DiegoColl | 3:b12ac8d9c397 | 213 | lcd.DisplayStringAt(00, LINE(2+L), (uint8_t *) "X:", LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 214 | lcd.DisplayStringAt(30, LINE(2+L), (uint8_t *) aux[3], LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 215 | lcd.DisplayStringAt(80, LINE(2+L), (uint8_t *) "Y:", LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 216 | lcd.DisplayStringAt(110, LINE(2+L), (uint8_t *) aux[4], LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 217 | lcd.DisplayStringAt(160, LINE(2+L), (uint8_t *) "Z:", LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 218 | lcd.DisplayStringAt(190, LINE(2+L), (uint8_t *) aux[5], LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 219 | |
DiegoColl | 3:b12ac8d9c397 | 220 | L = L + 1; |
DiegoColl | 3:b12ac8d9c397 | 221 | |
DiegoColl | 3:b12ac8d9c397 | 222 | if(L==9){ |
DiegoColl | 3:b12ac8d9c397 | 223 | L=0; |
DiegoColl | 3:b12ac8d9c397 | 224 | } |
DiegoColl | 3:b12ac8d9c397 | 225 | } |
DiegoColl | 3:b12ac8d9c397 | 226 | if(strcmp(aux[2],"D2") == 0){ |
DiegoColl | 3:b12ac8d9c397 | 227 | lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"GIROSCOPIO", CENTER_MODE); |
DiegoColl | 3:b12ac8d9c397 | 228 | |
DiegoColl | 3:b12ac8d9c397 | 229 | lcd.DisplayStringAt(00, LINE(2+L), (uint8_t *) "X:", LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 230 | lcd.DisplayStringAt(30, LINE(2+L), (uint8_t *) aux[3], LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 231 | lcd.DisplayStringAt(80, LINE(2+L), (uint8_t *) "Y:", LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 232 | lcd.DisplayStringAt(110, LINE(2+L), (uint8_t *) aux[4], LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 233 | lcd.DisplayStringAt(160, LINE(2+L), (uint8_t *) "Z:", LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 234 | lcd.DisplayStringAt(190, LINE(2+L), (uint8_t *) aux[5], LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 235 | |
DiegoColl | 3:b12ac8d9c397 | 236 | L = L + 1; |
DiegoColl | 3:b12ac8d9c397 | 237 | |
DiegoColl | 3:b12ac8d9c397 | 238 | if(L==9){ |
DiegoColl | 3:b12ac8d9c397 | 239 | L=0; |
DiegoColl | 3:b12ac8d9c397 | 240 | } |
DiegoColl | 3:b12ac8d9c397 | 241 | } |
DiegoColl | 3:b12ac8d9c397 | 242 | if(strcmp(aux[2],"D3") == 0){ |
DiegoColl | 3:b12ac8d9c397 | 243 | lcd.DisplayStringAt(0, LINE(0), (uint8_t *)"MAGNETOMETRO", CENTER_MODE); |
DiegoColl | 3:b12ac8d9c397 | 244 | |
DiegoColl | 3:b12ac8d9c397 | 245 | lcd.DisplayStringAt(00, LINE(2+L), (uint8_t *) "X:", LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 246 | lcd.DisplayStringAt(30, LINE(2+L), (uint8_t *) aux[3], LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 247 | lcd.DisplayStringAt(80, LINE(2+L), (uint8_t *) "Y:", LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 248 | lcd.DisplayStringAt(110, LINE(2+L), (uint8_t *) aux[4], LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 249 | lcd.DisplayStringAt(160, LINE(2+L), (uint8_t *) "Z:", LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 250 | lcd.DisplayStringAt(190, LINE(2+L), (uint8_t *) aux[5], LEFT_MODE); |
DiegoColl | 3:b12ac8d9c397 | 251 | |
DiegoColl | 3:b12ac8d9c397 | 252 | L = L + 1; |
DiegoColl | 3:b12ac8d9c397 | 253 | |
DiegoColl | 3:b12ac8d9c397 | 254 | if(L==9){ |
DiegoColl | 3:b12ac8d9c397 | 255 | L=0; |
DiegoColl | 3:b12ac8d9c397 | 256 | } |
DiegoColl | 3:b12ac8d9c397 | 257 | } |
DiegoColl | 1:6e255a933812 | 258 | } |
DiegoColl | 3:b12ac8d9c397 | 259 | |
DiegoColl | 3:b12ac8d9c397 | 260 | |
DiegoColl | 3:b12ac8d9c397 | 261 | /* |
DiegoColl | 1:6e255a933812 | 262 | if(strcmp(aux[2],"D1") == 0){ |
DiegoColl | 1:6e255a933812 | 263 | yx= 120 - *aux[3]; |
DiegoColl | 1:6e255a933812 | 264 | yy= 190 - *aux[4]; |
DiegoColl | 1:6e255a933812 | 265 | yz= 260 - *aux[5]; |
DiegoColl | 2:997b65c65e65 | 266 | pc.putc(yx); |
DiegoColl | 2:997b65c65e65 | 267 | pc.putc(yy); |
DiegoColl | 2:997b65c65e65 | 268 | pc.putc(yz); |
DiegoColl | 1:6e255a933812 | 269 | //uart.printf("<%s;%s;DT;2F>",ID,ST); |
DiegoColl | 1:6e255a933812 | 270 | } |
DiegoColl | 1:6e255a933812 | 271 | if(strcmp(aux[2],"D2") == 0){ |
DiegoColl | 2:997b65c65e65 | 272 | gx= 120 - *aux[3]; |
DiegoColl | 2:997b65c65e65 | 273 | gy= 190 - *aux[4]; |
DiegoColl | 2:997b65c65e65 | 274 | gz= 260 - *aux[5]; |
DiegoColl | 1:6e255a933812 | 275 | //uart.printf("<%s;%s;DT;2F>",ID,ST); |
DiegoColl | 1:6e255a933812 | 276 | } |
DiegoColl | 1:6e255a933812 | 277 | if(strcmp(aux[2],"D3") == 0){ |
DiegoColl | 2:997b65c65e65 | 278 | mx= 120 - *aux[3]; |
DiegoColl | 2:997b65c65e65 | 279 | my= 190 - *aux[4]; |
DiegoColl | 2:997b65c65e65 | 280 | mz= 260 - *aux[5]; |
DiegoColl | 1:6e255a933812 | 281 | //uart.printf("<%s;%s;DT;2F>",ID,ST); |
DiegoColl | 1:6e255a933812 | 282 | } |
DiegoColl | 3:b12ac8d9c397 | 283 | */ |
DiegoColl | 0:9cac1b16cf93 | 284 | } |
DiegoColl | 0:9cac1b16cf93 | 285 | borrar_buffer(buffer); |
DiegoColl | 0:9cac1b16cf93 | 286 | }; |
DiegoColl | 0:9cac1b16cf93 | 287 | |
DiegoColl | 0:9cac1b16cf93 | 288 | //codigo principal |
DiegoColl | 0:9cac1b16cf93 | 289 | |
DiegoColl | 0:9cac1b16cf93 | 290 | int main() { |
DiegoColl | 0:9cac1b16cf93 | 291 | |
DiegoColl | 3:b12ac8d9c397 | 292 | pc.printf("Inicio de programa\n"); //cambiar de destino al final |
DiegoColl | 3:b12ac8d9c397 | 293 | //uart.printf("Inicio de programa\n"); |
DiegoColl | 1:6e255a933812 | 294 | encabezado_lcd(); |
DiegoColl | 0:9cac1b16cf93 | 295 | |
DiegoColl | 0:9cac1b16cf93 | 296 | //------------------------------ Interrupciones |
DiegoColl | 0:9cac1b16cf93 | 297 | |
DiegoColl | 0:9cac1b16cf93 | 298 | button.rise(&speed); |
DiegoColl | 0:9cac1b16cf93 | 299 | uart.attach(&interrup); |
DiegoColl | 0:9cac1b16cf93 | 300 | |
DiegoColl | 0:9cac1b16cf93 | 301 | //------------------------------ programa |
DiegoColl | 0:9cac1b16cf93 | 302 | |
DiegoColl | 0:9cac1b16cf93 | 303 | while(1) { |
DiegoColl | 1:6e255a933812 | 304 | |
DiegoColl | 3:b12ac8d9c397 | 305 | //refrescar_lcd(); |
DiegoColl | 1:6e255a933812 | 306 | //blinkled(); |
DiegoColl | 0:9cac1b16cf93 | 307 | } |
DiegoColl | 0:9cac1b16cf93 | 308 | } |