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.
Fork of STINGR_counter2 by
main.cpp@2:a79ceae53e04, 2018-06-07 (annotated)
- Committer:
- JCON
- Date:
- Thu Jun 07 21:53:23 2018 +0000
- Revision:
- 2:a79ceae53e04
- Parent:
- 1:d140f24cf386
- Child:
- 3:6dbdf3288c41
TLE
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Sumobot | 0:88a700f174a3 | 1 | #include "mbed.h" //Se declara la librería mbed. |
| Sumobot | 0:88a700f174a3 | 2 | #include "rtos.h" |
| Sumobot | 0:88a700f174a3 | 3 | |
| Sumobot | 0:88a700f174a3 | 4 | DigitalOut led1(LED1); |
| Sumobot | 0:88a700f174a3 | 5 | DigitalOut led2(LED2); |
| Sumobot | 0:88a700f174a3 | 6 | DigitalOut led3(LED3); |
| Sumobot | 0:88a700f174a3 | 7 | DigitalOut led4(LED4); |
| Sumobot | 0:88a700f174a3 | 8 | Serial pc(USBTX, USBRX, 9600); // tx, rx Conunicación Serial con la PC |
| JCON | 2:a79ceae53e04 | 9 | DigitalIn CTS(p7, PullUp); // Pin Digital de entrada "CTS" en modo Pull-Up, para encontrarse normalmente a VCC cuando no haya un pulso. |
| JCON | 2:a79ceae53e04 | 10 | DigitalOut RTS(p8, 1); // Pin Digital de Salida "RTS"; Predefinido para valer 1 en su estado inactivo dentro del código. |
| Sumobot | 0:88a700f174a3 | 11 | Serial device(p9, p10, 9600); // tx, rx Comunicación Serial con el Módulo STX3 |
| Sumobot | 0:88a700f174a3 | 12 | int flag=1; // Declaración de la Bandera. |
| JCON | 2:a79ceae53e04 | 13 | int incomingByte=0; |
| Sumobot | 0:88a700f174a3 | 14 | Thread thread; |
| Sumobot | 0:88a700f174a3 | 15 | |
| Sumobot | 0:88a700f174a3 | 16 | void respuesta(){ |
| Sumobot | 1:d140f24cf386 | 17 | while(1){ |
| Sumobot | 0:88a700f174a3 | 18 | if(device.readable()) { // Se esperan datos provenientes del TX del módulo STX3 |
| JCON | 2:a79ceae53e04 | 19 | incomingByte=device.getc(); |
| JCON | 2:a79ceae53e04 | 20 | //pc.putc(num); |
| JCON | 2:a79ceae53e04 | 21 | pc.printf("%X",incomingByte); |
| JCON | 2:a79ceae53e04 | 22 | pc.printf(" "); |
| JCON | 2:a79ceae53e04 | 23 | // pc.putc(device.getc()); // Se muestra en pantalla la respuesta recibida por el módulo STX3 como una reacción al mensaje en HEX enviado |
| Sumobot | 0:88a700f174a3 | 24 | } |
| Sumobot | 1:d140f24cf386 | 25 | } |
| Sumobot | 0:88a700f174a3 | 26 | } |
| Sumobot | 0:88a700f174a3 | 27 | |
| Sumobot | 0:88a700f174a3 | 28 | void stx3() |
| Sumobot | 0:88a700f174a3 | 29 | { |
| JCON | 2:a79ceae53e04 | 30 | Thread::wait(200); // Se da un tiempo para que el analizador se estabilice |
| JCON | 2:a79ceae53e04 | 31 | incomingByte=0; |
| JCON | 2:a79ceae53e04 | 32 | pc.printf("El valor de CTS es %d\n\r",CTS.read()); // Se lee el valor de la variable CTS, la cual debe ser 1 |
| JCON | 2:a79ceae53e04 | 33 | pc.printf("El valor de RTS es %d\n\r",RTS.read()); // Se lee el valor de la variable RTS, la cual debe ser 1 |
| Sumobot | 0:88a700f174a3 | 34 | RTS=0; // Se manda un pulso en bajo en RTS, para inicial el proceso de transmisión |
| Sumobot | 0:88a700f174a3 | 35 | while(flag==1){ // Flag inicialmente vale 1, así que el ciclo while cambiará hasta que esa condición no se cumpla |
| Sumobot | 0:88a700f174a3 | 36 | flag=CTS.read(); // Cuando entra el ciclo, se iguala flag a CTS, el cual cuando cambie a 0 provocará que termine el while (máx 125 ms) |
| Sumobot | 0:88a700f174a3 | 37 | pc.printf("El valor de flag es %d\n\r", flag); // Se imprime el valor de flag, para identificar cuando termina el ciclo while |
| Sumobot | 0:88a700f174a3 | 38 | } |
| Sumobot | 0:88a700f174a3 | 39 | } |
| Sumobot | 0:88a700f174a3 | 40 | |
| Sumobot | 0:88a700f174a3 | 41 | int main() { |
| Sumobot | 0:88a700f174a3 | 42 | thread.start(respuesta); |
| Sumobot | 0:88a700f174a3 | 43 | |
| Sumobot | 0:88a700f174a3 | 44 | while(1) { |
| Sumobot | 0:88a700f174a3 | 45 | |
| Sumobot | 0:88a700f174a3 | 46 | switch (pc.getc()) |
| Sumobot | 0:88a700f174a3 | 47 | { |
| Sumobot | 0:88a700f174a3 | 48 | case '1': |
| Sumobot | 0:88a700f174a3 | 49 | { |
| Sumobot | 0:88a700f174a3 | 50 | led1=!led1; |
| JCON | 2:a79ceae53e04 | 51 | pc.printf("\n\rQuery ESN AA 05 01 50 D5\n\r"); |
| Sumobot | 0:88a700f174a3 | 52 | stx3(); |
| JCON | 2:a79ceae53e04 | 53 | Thread::wait(10); // Query ESN |
| Sumobot | 1:d140f24cf386 | 54 | device.putc(0XAA); |
| Sumobot | 0:88a700f174a3 | 55 | device.putc(0X05); |
| Sumobot | 1:d140f24cf386 | 56 | device.putc(0X01); |
| Sumobot | 1:d140f24cf386 | 57 | device.putc(0X50); |
| Sumobot | 1:d140f24cf386 | 58 | device.putc(0XD5); |
| JCON | 2:a79ceae53e04 | 59 | Thread::wait(10); // Se esperan .1 segundos una vez que se terminaron de hacer las transmisiones |
| Sumobot | 0:88a700f174a3 | 60 | //El tiempo total de transmisión es; el wait previo a las transmisiones, el tiempo que tarda el Mu en enviar los datos y el wait posterior a la transmisión |
| Sumobot | 0:88a700f174a3 | 61 | RTS=1; |
| JCON | 2:a79ceae53e04 | 62 | Thread::wait(150); |
| JCON | 2:a79ceae53e04 | 63 | pc.printf("\n\rCTS: %d\n\r",CTS.read()); |
| Sumobot | 0:88a700f174a3 | 64 | flag=1; |
| Sumobot | 0:88a700f174a3 | 65 | } |
| Sumobot | 0:88a700f174a3 | 66 | break; |
| Sumobot | 0:88a700f174a3 | 67 | |
| Sumobot | 0:88a700f174a3 | 68 | case '2': |
| Sumobot | 0:88a700f174a3 | 69 | { |
| Sumobot | 0:88a700f174a3 | 70 | led2=!led2; |
| JCON | 2:a79ceae53e04 | 71 | pc.printf("\n\rQuery Burst Remaining AA 05 04 FD 82\n\r"); |
| Sumobot | 0:88a700f174a3 | 72 | stx3(); |
| JCON | 2:a79ceae53e04 | 73 | Thread::wait(10); // Query Bursts Remaining |
| Sumobot | 1:d140f24cf386 | 74 | device.putc(0XAA); |
| Sumobot | 0:88a700f174a3 | 75 | device.putc(0X05); |
| Sumobot | 0:88a700f174a3 | 76 | device.putc(0X04); |
| Sumobot | 0:88a700f174a3 | 77 | device.putc(0XFD); |
| Sumobot | 0:88a700f174a3 | 78 | device.putc(0X82); |
| JCON | 2:a79ceae53e04 | 79 | Thread::wait(10); // Se esperan .1 segundos una vez que se terminaron de hacer las transmisiones |
| Sumobot | 0:88a700f174a3 | 80 | //El tiempo total de transmisión es; el wait previo a las transmisiones, el tiempo que tarda el Mu en enviar los datos y el wait posterior a la transmisión |
| Sumobot | 0:88a700f174a3 | 81 | RTS=1; |
| JCON | 2:a79ceae53e04 | 82 | Thread::wait(150); |
| JCON | 2:a79ceae53e04 | 83 | pc.printf("\n\rCTS: %d\n\r",CTS.read()); |
| Sumobot | 0:88a700f174a3 | 84 | flag=1; |
| Sumobot | 0:88a700f174a3 | 85 | } |
| Sumobot | 0:88a700f174a3 | 86 | break; |
| Sumobot | 0:88a700f174a3 | 87 | |
| Sumobot | 0:88a700f174a3 | 88 | case '3': |
| Sumobot | 0:88a700f174a3 | 89 | { |
| Sumobot | 0:88a700f174a3 | 90 | led3=!led3; |
| JCON | 2:a79ceae53e04 | 91 | pc.printf("\n\rQuery Firmware Version AA 05 05 74 93\n\r"); |
| Sumobot | 0:88a700f174a3 | 92 | stx3(); |
| JCON | 2:a79ceae53e04 | 93 | Thread::wait(10); // Query Firmware Version |
| Sumobot | 1:d140f24cf386 | 94 | device.putc(0XAA); |
| Sumobot | 0:88a700f174a3 | 95 | device.putc(0X05); |
| Sumobot | 1:d140f24cf386 | 96 | device.putc(0X05); |
| Sumobot | 1:d140f24cf386 | 97 | device.putc(0X74); |
| Sumobot | 1:d140f24cf386 | 98 | device.putc(0X93); |
| JCON | 2:a79ceae53e04 | 99 | Thread::wait(10); // Se esperan .1 segundos una vez que se terminaron de hacer las transmisiones |
| JCON | 2:a79ceae53e04 | 100 | //El tiempo total de transmisión es; el wait previo a las transmisiones, el tiempo que tarda el Mu en enviar los datos y el wait posterior a la transmisión |
| JCON | 2:a79ceae53e04 | 101 | RTS=1; |
| JCON | 2:a79ceae53e04 | 102 | Thread::wait(150); |
| JCON | 2:a79ceae53e04 | 103 | pc.printf("\n\rCTS: %d\n\r",CTS.read()); |
| JCON | 2:a79ceae53e04 | 104 | flag=1; |
| JCON | 2:a79ceae53e04 | 105 | } |
| JCON | 2:a79ceae53e04 | 106 | break; |
| JCON | 2:a79ceae53e04 | 107 | |
| JCON | 2:a79ceae53e04 | 108 | case '4': |
| JCON | 2:a79ceae53e04 | 109 | { |
| JCON | 2:a79ceae53e04 | 110 | led4=!led4; |
| JCON | 2:a79ceae53e04 | 111 | pc.printf("\n\rQuery SETUP AA 05 07 66 B0\n\r"); |
| JCON | 2:a79ceae53e04 | 112 | stx3(); |
| JCON | 2:a79ceae53e04 | 113 | Thread::wait(10); // Query SETUP |
| JCON | 2:a79ceae53e04 | 114 | device.putc(0XAA); |
| JCON | 2:a79ceae53e04 | 115 | device.putc(0X05); |
| JCON | 2:a79ceae53e04 | 116 | device.putc(0X07); |
| JCON | 2:a79ceae53e04 | 117 | device.putc(0X66); |
| JCON | 2:a79ceae53e04 | 118 | device.putc(0XB0); |
| JCON | 2:a79ceae53e04 | 119 | Thread::wait(10); // Se esperan .1 segundos una vez que se terminaron de hacer las transmisiones |
| JCON | 2:a79ceae53e04 | 120 | //El tiempo total de transmisión es; el wait previo a las transmisiones, el tiempo que tarda el Mu en enviar los datos y el wait posterior a la transmisión |
| JCON | 2:a79ceae53e04 | 121 | RTS=1; |
| JCON | 2:a79ceae53e04 | 122 | Thread::wait(150); |
| JCON | 2:a79ceae53e04 | 123 | pc.printf("\n\rCTS: %d\n\r",CTS.read()); |
| JCON | 2:a79ceae53e04 | 124 | flag=1; |
| JCON | 2:a79ceae53e04 | 125 | } |
| JCON | 2:a79ceae53e04 | 126 | break; |
| JCON | 2:a79ceae53e04 | 127 | |
| JCON | 2:a79ceae53e04 | 128 | case '5': |
| JCON | 2:a79ceae53e04 | 129 | { |
| JCON | 2:a79ceae53e04 | 130 | led1=!led1; |
| JCON | 2:a79ceae53e04 | 131 | pc.printf("\n\rQuery Hardware Version AA 05 09 18 59\n\r"); |
| JCON | 2:a79ceae53e04 | 132 | stx3(); |
| JCON | 2:a79ceae53e04 | 133 | Thread::wait(10); // Query Hardware Version |
| JCON | 2:a79ceae53e04 | 134 | device.putc(0XAA); |
| JCON | 2:a79ceae53e04 | 135 | device.putc(0X05); |
| JCON | 2:a79ceae53e04 | 136 | device.putc(0X09); |
| JCON | 2:a79ceae53e04 | 137 | device.putc(0X18); |
| JCON | 2:a79ceae53e04 | 138 | device.putc(0X59); |
| JCON | 2:a79ceae53e04 | 139 | Thread::wait(10); // Se esperan .1 segundos una vez que se terminaron de hacer las transmisiones |
| JCON | 2:a79ceae53e04 | 140 | //El tiempo total de transmisión es; el wait previo a las transmisiones, el tiempo que tarda el Mu en enviar los datos y el wait posterior a la transmisión |
| JCON | 2:a79ceae53e04 | 141 | RTS=1; |
| JCON | 2:a79ceae53e04 | 142 | Thread::wait(150); |
| JCON | 2:a79ceae53e04 | 143 | pc.printf("\n\rCTS: %d\n\r",CTS.read()); |
| JCON | 2:a79ceae53e04 | 144 | flag=1; |
| JCON | 2:a79ceae53e04 | 145 | } |
| JCON | 2:a79ceae53e04 | 146 | break; |
| JCON | 2:a79ceae53e04 | 147 | |
| JCON | 2:a79ceae53e04 | 148 | case '6': |
| JCON | 2:a79ceae53e04 | 149 | { |
| JCON | 2:a79ceae53e04 | 150 | led2=!led2; |
| JCON | 2:a79ceae53e04 | 151 | pc.printf("\n\rNAK AA 05 07 66 B1\n\r"); |
| JCON | 2:a79ceae53e04 | 152 | stx3(); |
| JCON | 2:a79ceae53e04 | 153 | Thread::wait(10); // Manda error NAK |
| JCON | 2:a79ceae53e04 | 154 | device.putc(0XAA); |
| JCON | 2:a79ceae53e04 | 155 | device.putc(0X05); |
| JCON | 2:a79ceae53e04 | 156 | device.putc(0X07); |
| JCON | 2:a79ceae53e04 | 157 | device.putc(0X66); |
| JCON | 2:a79ceae53e04 | 158 | device.putc(0XB1); |
| JCON | 2:a79ceae53e04 | 159 | Thread::wait(10); // Se esperan .1 segundos una vez que se terminaron de hacer las transmisiones |
| JCON | 2:a79ceae53e04 | 160 | //El tiempo total de transmisión es; el wait previo a las transmisiones, el tiempo que tarda el Mu en enviar los datos y el wait posterior a la transmisión |
| JCON | 2:a79ceae53e04 | 161 | RTS=1; |
| JCON | 2:a79ceae53e04 | 162 | Thread::wait(150); |
| JCON | 2:a79ceae53e04 | 163 | pc.printf("\n\rCTS: %d\n\r",CTS.read()); |
| JCON | 2:a79ceae53e04 | 164 | flag=1; |
| JCON | 2:a79ceae53e04 | 165 | } |
| JCON | 2:a79ceae53e04 | 166 | break; |
| JCON | 2:a79ceae53e04 | 167 | |
| JCON | 2:a79ceae53e04 | 168 | case '7': |
| JCON | 2:a79ceae53e04 | 169 | { |
| JCON | 2:a79ceae53e04 | 170 | led3=!led3; |
| JCON | 2:a79ceae53e04 | 171 | pc.printf("\n\rSETUP AA 0E 06 00 00 00 00 00 03 18 30 00 CE 9C\n\r"); |
| JCON | 2:a79ceae53e04 | 172 | stx3(); |
| JCON | 2:a79ceae53e04 | 173 | Thread::wait(10); // SETUP |
| JCON | 2:a79ceae53e04 | 174 | device.putc(0XAA); |
| JCON | 2:a79ceae53e04 | 175 | device.putc(0X0E); |
| JCON | 2:a79ceae53e04 | 176 | device.putc(0X06); |
| JCON | 2:a79ceae53e04 | 177 | device.putc(0X00); |
| JCON | 2:a79ceae53e04 | 178 | device.putc(0X00); |
| JCON | 2:a79ceae53e04 | 179 | device.putc(0X00); |
| JCON | 2:a79ceae53e04 | 180 | device.putc(0X00); |
| JCON | 2:a79ceae53e04 | 181 | device.putc(0X00); |
| JCON | 2:a79ceae53e04 | 182 | device.putc(0X03); |
| JCON | 2:a79ceae53e04 | 183 | device.putc(0X18); |
| JCON | 2:a79ceae53e04 | 184 | device.putc(0X30); |
| JCON | 2:a79ceae53e04 | 185 | device.putc(0X00); |
| JCON | 2:a79ceae53e04 | 186 | device.putc(0XCE); |
| JCON | 2:a79ceae53e04 | 187 | device.putc(0X9C); |
| JCON | 2:a79ceae53e04 | 188 | Thread::wait(10); // Se esperan .1 segundos una vez que se terminaron de hacer las transmisiones |
| JCON | 2:a79ceae53e04 | 189 | //El tiempo total de transmisión es; el wait previo a las transmisiones, el tiempo que tarda el Mu en enviar los datos y el wait posterior a la transmisión |
| JCON | 2:a79ceae53e04 | 190 | RTS=1; |
| JCON | 2:a79ceae53e04 | 191 | Thread::wait(150); |
| JCON | 2:a79ceae53e04 | 192 | pc.printf("\n\rCTS: %d\n\r",CTS.read()); |
| JCON | 2:a79ceae53e04 | 193 | flag=1; |
| JCON | 2:a79ceae53e04 | 194 | } |
| JCON | 2:a79ceae53e04 | 195 | break; |
| JCON | 2:a79ceae53e04 | 196 | |
| JCON | 2:a79ceae53e04 | 197 | case '8': |
| JCON | 2:a79ceae53e04 | 198 | { |
| JCON | 2:a79ceae53e04 | 199 | led4=!led4; |
| JCON | 2:a79ceae53e04 | 200 | pc.printf("\n\rSend Data AA 0E 00 01 02 03 04 05 06 07 08 09 BE E8\n\r"); |
| JCON | 2:a79ceae53e04 | 201 | stx3(); |
| JCON | 2:a79ceae53e04 | 202 | Thread::wait(10); // SEND DATA |
| JCON | 2:a79ceae53e04 | 203 | device.putc(0XAA); |
| JCON | 2:a79ceae53e04 | 204 | device.putc(0X0E); |
| JCON | 2:a79ceae53e04 | 205 | device.putc(0X00); |
| JCON | 2:a79ceae53e04 | 206 | device.putc(0X01); |
| JCON | 2:a79ceae53e04 | 207 | device.putc(0X02); |
| JCON | 2:a79ceae53e04 | 208 | device.putc(0X03); |
| JCON | 2:a79ceae53e04 | 209 | device.putc(0X04); |
| JCON | 2:a79ceae53e04 | 210 | device.putc(0X05); |
| JCON | 2:a79ceae53e04 | 211 | device.putc(0X06); |
| JCON | 2:a79ceae53e04 | 212 | device.putc(0X07); |
| JCON | 2:a79ceae53e04 | 213 | device.putc(0X08); |
| JCON | 2:a79ceae53e04 | 214 | device.putc(0X09); |
| JCON | 2:a79ceae53e04 | 215 | device.putc(0XBE); |
| JCON | 2:a79ceae53e04 | 216 | device.putc(0XE8); |
| JCON | 2:a79ceae53e04 | 217 | Thread::wait(10); // Se esperan .1 segundos una vez que se terminaron de hacer las transmisiones |
| Sumobot | 0:88a700f174a3 | 218 | //El tiempo total de transmisión es; el wait previo a las transmisiones, el tiempo que tarda el Mu en enviar los datos y el wait posterior a la transmisión |
| Sumobot | 0:88a700f174a3 | 219 | RTS=1; |
| JCON | 2:a79ceae53e04 | 220 | Thread::wait(150); |
| JCON | 2:a79ceae53e04 | 221 | pc.printf("\n\rCTS: %d\n\r",CTS.read()); |
| JCON | 2:a79ceae53e04 | 222 | flag=1; |
| JCON | 2:a79ceae53e04 | 223 | } |
| JCON | 2:a79ceae53e04 | 224 | break; |
| JCON | 2:a79ceae53e04 | 225 | |
| JCON | 2:a79ceae53e04 | 226 | |
| JCON | 2:a79ceae53e04 | 227 | case '9': |
| JCON | 2:a79ceae53e04 | 228 | { |
| JCON | 2:a79ceae53e04 | 229 | led1=!led1; |
| JCON | 2:a79ceae53e04 | 230 | pc.printf("\n\rAbort Transmission AA 05 03 42 F6\n\r"); |
| JCON | 2:a79ceae53e04 | 231 | stx3(); |
| JCON | 2:a79ceae53e04 | 232 | Thread::wait(10); // Abort Transmission |
| JCON | 2:a79ceae53e04 | 233 | device.putc(0XAA); |
| JCON | 2:a79ceae53e04 | 234 | device.putc(0X05); |
| JCON | 2:a79ceae53e04 | 235 | device.putc(0X03); |
| JCON | 2:a79ceae53e04 | 236 | device.putc(0X42); |
| JCON | 2:a79ceae53e04 | 237 | device.putc(0XF6); |
| JCON | 2:a79ceae53e04 | 238 | Thread::wait(10); // Se esperan .1 segundos una vez que se terminaron de hacer las transmisiones |
| JCON | 2:a79ceae53e04 | 239 | //El tiempo total de transmisión es; el wait previo a las transmisiones, el tiempo que tarda el Mu en enviar los datos y el wait posterior a la transmisión |
| JCON | 2:a79ceae53e04 | 240 | RTS=1; |
| JCON | 2:a79ceae53e04 | 241 | Thread::wait(150); |
| JCON | 2:a79ceae53e04 | 242 | pc.printf("\n\rCTS: %d\n\r",CTS.read()); |
| JCON | 2:a79ceae53e04 | 243 | flag=1; |
| JCON | 2:a79ceae53e04 | 244 | } |
| JCON | 2:a79ceae53e04 | 245 | break; |
| JCON | 2:a79ceae53e04 | 246 | |
| JCON | 2:a79ceae53e04 | 247 | case 'A': |
| JCON | 2:a79ceae53e04 | 248 | { |
| JCON | 2:a79ceae53e04 | 249 | led2=!led2; |
| JCON | 2:a79ceae53e04 | 250 | pc.printf("\n\rSend Data for PDR\n\r"); |
| JCON | 2:a79ceae53e04 | 251 | stx3(); |
| JCON | 2:a79ceae53e04 | 252 | Thread::wait(10); // SEND DATA |
| JCON | 2:a79ceae53e04 | 253 | device.putc(0XAA); |
| JCON | 2:a79ceae53e04 | 254 | device.putc(0X65); |
| JCON | 2:a79ceae53e04 | 255 | device.putc(0X00); |
| JCON | 2:a79ceae53e04 | 256 | device.putc(0X41); |
| JCON | 2:a79ceae53e04 | 257 | device.putc(0X6E); |
| JCON | 2:a79ceae53e04 | 258 | device.putc(0X64); |
| JCON | 2:a79ceae53e04 | 259 | device.putc(0X72); |
| JCON | 2:a79ceae53e04 | 260 | device.putc(0X65); |
| JCON | 2:a79ceae53e04 | 261 | device.putc(0X73); |
| JCON | 2:a79ceae53e04 | 262 | device.putc(0X20); |
| JCON | 2:a79ceae53e04 | 263 | device.putc(0X4D); |
| JCON | 2:a79ceae53e04 | 264 | device.putc(0X61); |
| JCON | 2:a79ceae53e04 | 265 | device.putc(0X72); |
| JCON | 2:a79ceae53e04 | 266 | device.putc(0X74); |
| JCON | 2:a79ceae53e04 | 267 | device.putc(0X69); |
| JCON | 2:a79ceae53e04 | 268 | device.putc(0X6E); |
| JCON | 2:a79ceae53e04 | 269 | device.putc(0X65); |
| JCON | 2:a79ceae53e04 | 270 | device.putc(0X7A); |
| JCON | 2:a79ceae53e04 | 271 | device.putc(0X20); |
| JCON | 2:a79ceae53e04 | 272 | device.putc(0X4E); |
| JCON | 2:a79ceae53e04 | 273 | device.putc(0X41); |
| JCON | 2:a79ceae53e04 | 274 | device.putc(0X53); |
| JCON | 2:a79ceae53e04 | 275 | device.putc(0X41); |
| JCON | 2:a79ceae53e04 | 276 | device.putc(0X0D); |
| JCON | 2:a79ceae53e04 | 277 | device.putc(0X0A); |
| JCON | 2:a79ceae53e04 | 278 | device.putc(0X43); |
| JCON | 2:a79ceae53e04 | 279 | device.putc(0X61); |
| JCON | 2:a79ceae53e04 | 280 | device.putc(0X72); |
| JCON | 2:a79ceae53e04 | 281 | device.putc(0X6C); |
| JCON | 2:a79ceae53e04 | 282 | device.putc(0X6F); |
| JCON | 2:a79ceae53e04 | 283 | device.putc(0X73); |
| JCON | 2:a79ceae53e04 | 284 | device.putc(0X20); |
| JCON | 2:a79ceae53e04 | 285 | device.putc(0X44); |
| JCON | 2:a79ceae53e04 | 286 | device.putc(0X75); |
| JCON | 2:a79ceae53e04 | 287 | device.putc(0X61); |
| JCON | 2:a79ceae53e04 | 288 | device.putc(0X72); |
| JCON | 2:a79ceae53e04 | 289 | device.putc(0X74); |
| JCON | 2:a79ceae53e04 | 290 | device.putc(0X65); |
| JCON | 2:a79ceae53e04 | 291 | device.putc(0X20); |
| JCON | 2:a79ceae53e04 | 292 | device.putc(0X41); |
| JCON | 2:a79ceae53e04 | 293 | device.putc(0X45); |
| JCON | 2:a79ceae53e04 | 294 | device.putc(0X4D); |
| JCON | 2:a79ceae53e04 | 295 | device.putc(0X0D); |
| JCON | 2:a79ceae53e04 | 296 | device.putc(0X0A); |
| JCON | 2:a79ceae53e04 | 297 | device.putc(0X45); |
| JCON | 2:a79ceae53e04 | 298 | device.putc(0X75); |
| JCON | 2:a79ceae53e04 | 299 | device.putc(0X67); |
| JCON | 2:a79ceae53e04 | 300 | device.putc(0X65); |
| JCON | 2:a79ceae53e04 | 301 | device.putc(0X6E); |
| JCON | 2:a79ceae53e04 | 302 | device.putc(0X69); |
| JCON | 2:a79ceae53e04 | 303 | device.putc(0X6F); |
| JCON | 2:a79ceae53e04 | 304 | device.putc(0X20); |
| JCON | 2:a79ceae53e04 | 305 | device.putc(0X55); |
| JCON | 2:a79ceae53e04 | 306 | device.putc(0X72); |
| JCON | 2:a79ceae53e04 | 307 | device.putc(0X72); |
| JCON | 2:a79ceae53e04 | 308 | device.putc(0X75); |
| JCON | 2:a79ceae53e04 | 309 | device.putc(0X74); |
| JCON | 2:a79ceae53e04 | 310 | device.putc(0X69); |
| JCON | 2:a79ceae53e04 | 311 | device.putc(0X61); |
| JCON | 2:a79ceae53e04 | 312 | device.putc(0X20); |
| JCON | 2:a79ceae53e04 | 313 | device.putc(0X55); |
| JCON | 2:a79ceae53e04 | 314 | device.putc(0X50); |
| JCON | 2:a79ceae53e04 | 315 | device.putc(0X41); |
| JCON | 2:a79ceae53e04 | 316 | device.putc(0X45); |
| JCON | 2:a79ceae53e04 | 317 | device.putc(0X50); |
| JCON | 2:a79ceae53e04 | 318 | device.putc(0X0D); |
| JCON | 2:a79ceae53e04 | 319 | device.putc(0X0A); |
| JCON | 2:a79ceae53e04 | 320 | device.putc(0X46); |
| JCON | 2:a79ceae53e04 | 321 | device.putc(0X65); |
| JCON | 2:a79ceae53e04 | 322 | device.putc(0X62); |
| JCON | 2:a79ceae53e04 | 323 | device.putc(0X72); |
| JCON | 2:a79ceae53e04 | 324 | device.putc(0X75); |
| JCON | 2:a79ceae53e04 | 325 | device.putc(0X61); |
| JCON | 2:a79ceae53e04 | 326 | device.putc(0X72); |
| JCON | 2:a79ceae53e04 | 327 | device.putc(0X79); |
| JCON | 2:a79ceae53e04 | 328 | device.putc(0X20); |
| JCON | 2:a79ceae53e04 | 329 | device.putc(0X32); |
| JCON | 2:a79ceae53e04 | 330 | device.putc(0X30); |
| JCON | 2:a79ceae53e04 | 331 | device.putc(0X74); |
| JCON | 2:a79ceae53e04 | 332 | device.putc(0X68); |
| JCON | 2:a79ceae53e04 | 333 | device.putc(0X20); |
| JCON | 2:a79ceae53e04 | 334 | device.putc(0X32); |
| JCON | 2:a79ceae53e04 | 335 | device.putc(0X30); |
| JCON | 2:a79ceae53e04 | 336 | device.putc(0X31); |
| JCON | 2:a79ceae53e04 | 337 | device.putc(0X38); |
| JCON | 2:a79ceae53e04 | 338 | device.putc(0X0D); |
| JCON | 2:a79ceae53e04 | 339 | device.putc(0X0A); |
| JCON | 2:a79ceae53e04 | 340 | device.putc(0X50); |
| JCON | 2:a79ceae53e04 | 341 | device.putc(0X44); |
| JCON | 2:a79ceae53e04 | 342 | device.putc(0X52); |
| JCON | 2:a79ceae53e04 | 343 | device.putc(0X20); |
| JCON | 2:a79ceae53e04 | 344 | device.putc(0X61); |
| JCON | 2:a79ceae53e04 | 345 | device.putc(0X70); |
| JCON | 2:a79ceae53e04 | 346 | device.putc(0X70); |
| JCON | 2:a79ceae53e04 | 347 | device.putc(0X72); |
| JCON | 2:a79ceae53e04 | 348 | device.putc(0X6F); |
| JCON | 2:a79ceae53e04 | 349 | device.putc(0X76); |
| JCON | 2:a79ceae53e04 | 350 | device.putc(0X65); |
| JCON | 2:a79ceae53e04 | 351 | device.putc(0X64); |
| JCON | 2:a79ceae53e04 | 352 | device.putc(0XC8); |
| JCON | 2:a79ceae53e04 | 353 | device.putc(0X16); |
| JCON | 2:a79ceae53e04 | 354 | Thread::wait(10); // Se esperan .1 segundos una vez que se terminaron de hacer las transmisiones |
| JCON | 2:a79ceae53e04 | 355 | //El tiempo total de transmisión es; el wait previo a las transmisiones, el tiempo que tarda el Mu en enviar los datos y el wait posterior a la transmisión |
| JCON | 2:a79ceae53e04 | 356 | RTS=1; |
| JCON | 2:a79ceae53e04 | 357 | Thread::wait(150); |
| JCON | 2:a79ceae53e04 | 358 | pc.printf("\n\rCTS: %d\n\r",CTS.read()); |
| Sumobot | 0:88a700f174a3 | 359 | flag=1; |
| Sumobot | 0:88a700f174a3 | 360 | } |
| Sumobot | 0:88a700f174a3 | 361 | break; |
| Sumobot | 0:88a700f174a3 | 362 | } |
| Sumobot | 0:88a700f174a3 | 363 | } |
| JCON | 2:a79ceae53e04 | 364 | |
| JCON | 2:a79ceae53e04 | 365 | |
| Sumobot | 0:88a700f174a3 | 366 | } |
| Sumobot | 0:88a700f174a3 | 367 |
